Made ShortCutNum

This commit is contained in:
Andreas Strauman 2020-09-14 10:59:49 +02:00
parent 338230129d
commit f431b8a8ed
3 changed files with 254 additions and 243 deletions

View File

@ -1,7 +1,7 @@
;got from http://www.autohotkey.com/forum/viewtopic.php?p=107547#107547 ;got from http://www.autohotkey.com/forum/viewtopic.php?p=107547#107547
;*********************************************************************Calculator ;*********************************************************************Calculator
Eval(X) CalcEval(X)
{ {
Global Monitor1Left Global Monitor1Left
Global Monitor1Right Global Monitor1Right

View File

@ -68,18 +68,18 @@ Drop_Command:
return return
} }
If (NGroups < FirstNumber * 10) ; If (NGroups < FirstNumber * 10)
{ ; {
If (FirstNumber = "0") ; If (FirstNumber = "0")
{ ; {
GoSub, Command_Hide ; GoSub, Command_Hide
WinMinimize,A ; WinMinimize,A
return ; return
} ; }
GoSub, Command_Hide ; GoSub, Command_Hide
MoveToGrid(FirstNumber) ; MoveToGrid(FirstNumber)
return ; return
} ; }
Command2: Command2:
output := FirstNumber . " -" output := FirstNumber . " -"

View File

@ -831,19 +831,20 @@ creategroups:
setGuiColors() setGuiColors()
loop,%NGroups% loop,%NGroups%
{ {
TriggerTop := %A_Index%TriggerTop - ScreenTop PosIndex := %A_Index%PosNum
TriggerBottom := %A_Index%TriggerBottom - ScreenTop TriggerTop := %PosIndex%TriggerTop - ScreenTop
TriggerLeft := %A_Index%TriggerLeft - ScreenLeft TriggerBottom := %PosIndex%TriggerBottom - ScreenTop
TriggerRight := %A_Index%TriggerRight - ScreenLeft TriggerLeft := %PosIndex%TriggerLeft - ScreenLeft
TriggerRight := %PosIndex%TriggerRight - ScreenLeft
TriggerHeight := TriggerBottom - TriggerTop TriggerHeight := TriggerBottom - TriggerTop
TriggerWidth := TriggerRight - TriggerLeft TriggerWidth := TriggerRight - TriggerLeft
GridTop := %A_Index%GridTop GridTop := %PosIndex%GridTop
GridLeft := %A_Index%GridLeft GridLeft := %PosIndex%GridLeft
TextTop := %A_Index%TriggerTop - ScreenTop TextTop := %PosIndex%TriggerTop - ScreenTop
TextTop += Round((%A_Index%TriggerBottom - %A_Index%TriggerTop) / 2 )- 11 TextTop += Round((%PosIndex%TriggerBottom - %PosIndex%TriggerTop) / 2 )- 11
TextLeft := %A_Index%TriggerLeft - ScreenLeft TextLeft := %PosIndex%TriggerLeft - ScreenLeft
TextLeft += Round((%A_Index%TriggerRight - %A_Index%TriggerLeft) / 2) - 5 TextLeft += Round((%PosIndex%TriggerRight - %PosIndex%TriggerLeft) / 2) - 5
RestoreLeft := TextLeft - 50 RestoreLeft := TextLeft - 50
tempTop := triggerTop - 1 tempTop := triggerTop - 1
tempBottom := triggerBottom - 1 tempBottom := triggerBottom - 1
@ -862,15 +863,15 @@ creategroups:
If ShowNumbersFlag If ShowNumbersFlag
If GridTop is number If GridTop is number
If GridLeft is number If GridLeft is number
If A_Index < 10 If PosIndex < 10
{ {
Gui, add, text, BackGroundTrans c%shadowcolor% X%ShadowLeft% Y%ShadowTop% ,%A_Index% Gui, add, text, BackGroundTrans c%shadowcolor% X%ShadowLeft% Y%ShadowTop% ,%PosIndex%
Gui, add, text, BackGroundTrans c%textcolor% X%TextLeft% Y%TextTop% ,%A_Index% Gui, add, text, BackGroundTrans c%textcolor% X%TextLeft% Y%TextTop% ,%PosIndex%
} }
else else
{ {
Gui, add, text,% "X" ShadowLeft - 6 " Y" ShadowTop "c"shadowcolor "BackGroundTrans" ,%A_Index% Gui, add, text,% "X" ShadowLeft - 6 " Y" ShadowTop "c"shadowcolor "BackGroundTrans" ,%PosIndex%
Gui, add, text,% "X" TextLeft - 6 " Y" TextTop "c"textcolor "BackGroundTrans" ,%A_Index% Gui, add, text,% "X" TextLeft - 6 " Y" TextTop "c"textcolor "BackGroundTrans" ,%PosIndex%
} }
@ -922,12 +923,12 @@ creategroups:
If Gridtop = Run If Gridtop = Run
{ {
GridBottom := %A_Index%GridBottom GridBottom := %PosIndex%GridBottom
GridLeft := %A_Index%GridLeft GridLeft := %PosIndex%GridLeft
If ShowNumbersFlag If ShowNumbersFlag
{ {
If (%A_Index%GridBottom != "") If (%PosIndex%GridBottom != "")
{ {
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%A_Index%-%GridBottom% Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%A_Index%-%GridBottom%
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%A_Index%-%GridBottom% Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%A_Index%-%GridBottom%
@ -939,7 +940,7 @@ creategroups:
} }
}else }else
{ {
If (%A_Index%GridBottom != "") If (%PosIndex%GridBottom != "")
{ {
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%GridBottom% Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%GridBottom%
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%GridBottom% Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%GridBottom%
@ -1210,7 +1211,7 @@ ApplyGrid:
else else
GoSub, CreateGridFromFile GoSub, CreateGridFromFile
return return
; RegisterGridTile()
CreateGridFromFile: CreateGridFromFile:
Menu,templates_menu,DeleteAll Menu,templates_menu,DeleteAll
createTemplatesMenu() createTemplatesMenu()
@ -1226,19 +1227,26 @@ CreateGridFromFile:
return return
} }
ErrorLevel := False ErrorLevel := False
NShortCuts := %NGroups%
loop,%NGroups% loop,%NGroups%
{ {
if a_index = "0" if a_index = "0"
continue continue
TriggerTop = %A_Index%TriggerTop IniRead, PosIndex, %A_ScriptDir%\%GridName%,%A_Index%, ShortCutNum, %A_Index%
TriggerBottom = %A_Index%TriggerBottom if (ErrorLevel != 0 AND %PosNum% = %A_Index% )
TriggerRight = %A_Index%TriggerRight {
TriggerLeft = %A_Index%TriggerLeft ErrorLevel := False
}
%A_Index%PosNum = %PosIndex%
TriggerTop = %PosIndex%TriggerTop
TriggerBottom = %PosIndex%TriggerBottom
TriggerRight = %PosIndex%TriggerRight
TriggerLeft = %PosIndex%TriggerLeft
GridTop = %A_Index%GridTop GridTop = %PosIndex%GridTop
GridBottom = %A_Index%GridBottom GridBottom = %PosIndex%GridBottom
GridRight = %A_Index%GridRight GridRight = %PosIndex%GridRight
GridLeft = %A_Index%GridLeft GridLeft = %PosIndex%GridLeft
IniRead,%TriggerTop% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerTop,Error IniRead,%TriggerTop% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerTop,Error
IniRead,%TriggerBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerBottom,Error IniRead,%TriggerBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerBottom,Error
@ -1249,6 +1257,7 @@ CreateGridFromFile:
IniRead,%GridBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,GridBottom,Error IniRead,%GridBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,GridBottom,Error
IniRead,%GridLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,GridLeft,Error IniRead,%GridLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,GridLeft,Error
IniRead,%GridRight% ,%A_ScriptDir%\%GridName%,%A_Index%,GridRight,Error IniRead,%GridRight% ,%A_ScriptDir%\%GridName%,%A_Index%,GridRight,Error
; IniRead,%PosNum% ,%A_ScriptDir%\%GridName%,%PosIndex%,PosNum,%PosIndex%
If (%TriggerTop%="Error" OR %TriggerBottom%="Error" If (%TriggerTop%="Error" OR %TriggerBottom%="Error"
OR %TriggerLeft%="Error" OR %TriggerRight%="Error" ) OR %TriggerLeft%="Error" OR %TriggerRight%="Error" )
@ -1401,36 +1410,38 @@ evaluateGrid()
count := 0 count := 0
loop,%NGroups% loop,%NGroups%
{ {
PosIndex := %A_Index%PosNum
value := A_Index - count value := A_Index - count
PosIndex := %value%PosNum
%value%TriggerTop := eval(%A_Index%TriggerTop) %PosIndex%TriggerTop := CalcEval(%PosIndex%TriggerTop)
%value%TriggerBottom := eval(%A_Index%TriggerBottom) %PosIndex%TriggerBottom := CalcEval(%PosIndex%TriggerBottom)
%value%TriggerLeft := eval(%A_Index%TriggerLeft) %PosIndex%TriggerLeft := CalcEval(%PosIndex%TriggerLeft)
%value%TriggerRight := eval(%A_Index%TriggerRight) %PosIndex%TriggerRight := CalcEval(%PosIndex%TriggerRight)
If (%A_Index%GridTop = "Run") If (%PosIndex%GridTop = "Run")
{ {
%value%GridTop := %A_Index%GridTop %PosIndex%GridTop := %PosIndex%GridTop
%value%GridBottom := %A_Index%GridBottom %PosIndex%GridBottom := %PosIndex%GridBottom
%value%GridLeft := %A_Index%GridLeft %PosIndex%GridLeft := %PosIndex%GridLeft
%value%GridRight := %A_Index%GridRight %PosIndex%GridRight := %PosIndex%GridRight
continue continue
} }
if(%value%GridTop <> "") if(%PosIndex%GridTop <> "")
%value%GridTop := eval(%A_Index%GridTop) %PosIndex%GridTop := CalcEval(%PosIndex%GridTop)
if(%value%GridBottom <> "") if(%PosIndex%GridBottom <> "")
%value%GridBottom := eval(%A_Index%GridBottom) %PosIndex%GridBottom := CalcEval(%PosIndex%GridBottom)
if(%value%GridLeft <> "") if(%PosIndex%GridLeft <> "")
%value%GridLeft := eval(%A_Index%GridLeft) %PosIndex%GridLeft := CalcEval(%PosIndex%GridLeft)
if(%value%GridRight <> "") if(%PosIndex%GridRight <> "")
%value%GridRight := eval(%A_Index%GridRight) %PosIndex%GridRight := CalcEval(%PosIndex%GridRight)
if (%value%TriggerTop = "error" OR %value%TriggerBottom = "Error" if (%PosIndex%TriggerTop = "error" OR %PosIndex%TriggerBottom = "Error"
OR %value%TriggerLeft = "error" OR %value%TriggerRight = "error" OR %PosIndex%TriggerLeft = "error" OR %PosIndex%TriggerRight = "error"
OR %value%GridTop = "error" OR %value%GridBottom = "Error" OR %PosIndex%GridTop = "error" OR %PosIndex%GridBottom = "Error"
OR %value%GridLeft = "error" OR %value%GridRight = "error") OR %PosIndex%GridLeft = "error" OR %PosIndex%GridRight = "error")
{ {
count += 1 count += 1
continue continue