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

124
Calc.ahk
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
@ -45,29 +45,29 @@ Eval(X)
; Global WindowTop ; Global WindowTop
; Global WindowWidth ; Global WindowWidth
; Global WindowHeight ; Global WindowHeight
StringReplace,x, x, %A_Space%,, All ; remove white space StringReplace,x, x, %A_Space%,, All ; remove white space
StringReplace,x, x, %A_Tab%,, All StringReplace,x, x, %A_Tab%,, All
StringReplace,x, x, -, #, All ; # = subtraction StringReplace,x, x, -, #, All ; # = subtraction
StringReplace,x, x, (#, (0#, All ; (-x -> (0-x StringReplace,x, x, (#, (0#, All ; (-x -> (0-x
If (Asc(x) = Asc("#")) If (Asc(x) = Asc("#"))
x = 0%x% ; leading -x -> 0-x x = 0%x% ; leading -x -> 0-x
StringReplace x, x, (+, (, All ; (+x -> (x StringReplace x, x, (+, (, All ; (+x -> (x
If (Asc(x) = Asc("+")) If (Asc(x) = Asc("+"))
StringTrimLeft x, x, 1 ; leading +x -> x StringTrimLeft x, x, 1 ; leading +x -> x
Loop Loop
{ ; replace constants { ; replace constants
StringGetPos,i, x, [ ; find [ StringGetPos,i, x, [ ; find [
IfLess i,0, Break IfLess i,0, Break
StringGetPos,j, x, ], L, i+1 ; closest ] StringGetPos,j, x, ], L, i+1 ; closest ]
StringMid,y, x, i+2, j-i-1 ; variable in [] StringMid,y, x, i+2, j-i-1 ; variable in []
StringLeft,L, x, i StringLeft,L, x, i
StringTrimLeft,R, x, j+1 StringTrimLeft,R, x, j+1
if (%Y% = "") if (%Y% = "")
{ {
;msgbox,error: %y% ;msgbox,error: %y%
return "Error" return "Error"
} }
x := L . %y% . R ; replace [var] with value of var x := L . %y% . R ; replace [var] with value of var
} }
Loop Loop
{ ;finding an innermost (..) { ;finding an innermost (..)
@ -79,55 +79,55 @@ Eval(X)
StringTrimLeft,R, x, j+1 ;Right Part of the expression StringTrimLeft,R, x, j+1 ;Right Part of the expression
x := L . Eval@(y) . R ;replace (x) with value of x x := L . Eval@(y) . R ;replace (x) with value of x
} }
Return Eval@(X) Return Eval@(X)
} }
Eval@(x) Eval@(x)
{ {
StringGetPos,i, x, +, R ; i = -1 if no + is found StringGetPos,i, x, +, R ; i = -1 if no + is found
StringGetPos,j, x, #, R StringGetPos,j, x, #, R
If (i > j)
Return Left(x,i)+Right(x,i)
If (j > i) ; i = j only if no + or - found
Return Left(x,j)-Right(x,j)
StringGetPos,i, x, *, R
StringGetPos,j, x, /, R
If (i > j) If (i > j)
Return Left(x,i)*Right(x,i) Return Left(x,i)+Right(x,i)
If (j > i) ; i = j only if no + or - found
Return Left(x,j)-Right(x,j)
StringGetPos,i, x, *, R
StringGetPos,j, x, /, R
If (i > j)
Return Left(x,i)*Right(x,i)
If (j > i) If (j > i)
Return Left(x,j)/Right(x,j) Return Left(x,j)/Right(x,j)
StringGetPos,i1, x, abs, R ; no more operators StringGetPos,i1, x, abs, R ; no more operators
StringGetPos,i2, x, ceil, R ; look for functions StringGetPos,i2, x, ceil, R ; look for functions
StringGetPos,i3, x, floor, R ; insert further functions below StringGetPos,i3, x, floor, R ; insert further functions below
m := Max1(i1,i2,i3) m := Max1(i1,i2,i3)
If (m = i1) ; apply the rightmost function If (m = i1) ; apply the rightmost function
Return abs(Right(x,i1+2)) ; only one function is applied Return abs(Right(x,i1+2)) ; only one function is applied
Else If (m = i2) ; in one recursion Else If (m = i2) ; in one recursion
Return ceil(Right(x,i2+3)) Return ceil(Right(x,i2+3))
Else If (m = i3) Else If (m = i3)
Return floor(Right(x,i3+4)) ; offset j + StrLen(func) - 2 Return floor(Right(x,i3+4)) ; offset j + StrLen(func) - 2
Return x Return x
} }
Left(x,i) Left(x,i)
{ {
StringLeft,x, x, i StringLeft,x, x, i
Return Eval@(x) Return Eval@(x)
}
Right(x,i)
{
StringTrimLeft,x, x, i+1
Return Eval@(x)
} }
Max1(x0,x1="",x2="",x3="",x4="",x5="",x6="",x7="",x8="",x9="",x10="",x11="",x12="",x13="",x14="",x15="",x16="",x17="",x18="",x19="",x20="") Right(x,i)
{ {
x := x0 StringTrimLeft,x, x, i+1
Loop 20 Return Eval@(x)
{ }
IfEqual x%A_Index%,, Break Max1(x0,x1="",x2="",x3="",x4="",x5="",x6="",x7="",x8="",x9="",x10="",x11="",x12="",x13="",x14="",x15="",x16="",x17="",x18="",x19="",x20="")
IfGreater x%A_Index%, %x% {
x := x%A_Index% x := x0
} Loop 20
IfLess x,0, Return -2 ; prevent match with -1 {
Return %x% IfEqual x%A_Index%,, Break
IfGreater x%A_Index%, %x%
x := x%A_Index%
}
IfLess x,0, Return -2 ; prevent match with -1
Return %x%
} }

View File

@ -4,7 +4,7 @@
;function: Adjusts windows to a predefined or user-defined desktop grid. ;function: Adjusts windows to a predefined or user-defined desktop grid.
Command: Command:
GoSub, ShowGroups GoSub, ShowGroups
Drop_Command: Drop_Command:
@ -22,7 +22,7 @@ Drop_Command:
GoSub, Command_Hide GoSub, Command_Hide
return return
} }
If FirstNumber is not number If FirstNumber is not number
{ {
If (FirstNumber = "M") If (FirstNumber = "M")
@ -49,7 +49,7 @@ Drop_Command:
{ {
GoSub, Command_Hide GoSub, Command_Hide
msgbox,NOT DONE!! msgbox,NOT DONE!!
; WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop, ; WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop,
; StoreWindowState(WindowId,WinLeft,WinTop,WinWidth,WinHeight) ; StoreWindowState(WindowId,WinLeft,WinTop,WinWidth,WinHeight)
return return
} }
@ -67,19 +67,19 @@ Drop_Command:
GoSub, Command_Hide GoSub, Command_Hide
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 . " -"
@ -121,14 +121,14 @@ Drop_Command:
GoSub, Command_Hide GoSub, Command_Hide
return return
} }
If firstnumber = 0 If firstnumber = 0
GridNumber := SecondNumber GridNumber := SecondNumber
else else
GridNumber := FirstNumber . SecondNumber GridNumber := FirstNumber . SecondNumber
GoSub, Command_Hide GoSub, Command_Hide
MoveToGrid(GridNumber) MoveToGrid(GridNumber)
return return
OSDCreate() OSDCreate()
{ {
@ -137,7 +137,7 @@ OSDCreate()
Gui,4: Font,S13 Gui,4: Font,S13
Gui,4: Add, Button, vOSD x0 y0 w100 h30 , Gui,4: Add, Button, vOSD x0 y0 w100 h30 ,
Gui,4: Color, EEAAEE Gui,4: Color, EEAAEE
Gui,4: Show, x0 y0 w0 h0 noactivate, OSD Gui,4: Show, x0 y0 w0 h0 noactivate, OSD
Gui,4: hide Gui,4: hide
WinSet, TransColor, EEAAEE,OSD WinSet, TransColor, EEAAEE,OSD
return return
@ -157,7 +157,7 @@ OSDWrite(Value)
Gui,4:Show, x%Xpos% y%Ypos% w100 h30 noactivate Gui,4:Show, x%Xpos% y%Ypos% w100 h30 noactivate
return return
} }
OSDHide() OSDHide()
{ {
Gui,4:hide, Gui,4:hide,
@ -210,7 +210,7 @@ MoveToGrid(GridToMove)
if ShouldUseSizeMoveMessage(WinClass) if ShouldUseSizeMoveMessage(WinClass)
SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid% SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid%
WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop, WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop,
if ShouldUseSizeMoveMessage(WinClass) if ShouldUseSizeMoveMessage(WinClass)
SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid% SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid%
@ -224,7 +224,7 @@ MoveToGrid(GridToMove)
if ShouldUseSizeMoveMessage(WinClass) if ShouldUseSizeMoveMessage(WinClass)
SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid% SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid%
WinMove, A, ,%GridLeft%,%WinTop%, % GridRight - GridLeft,%WinHeight%, WinMove, A, ,%GridLeft%,%WinTop%, % GridRight - GridLeft,%WinHeight%,
if ShouldUseSizeMoveMessage(WinClass) if ShouldUseSizeMoveMessage(WinClass)
SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid% SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid%
@ -233,7 +233,7 @@ MoveToGrid(GridToMove)
} }
If (GridTop = "AlwaysOnTop") If (GridTop = "AlwaysOnTop")
{ {
WinSet, AlwaysOnTop, Toggle,A WinSet, AlwaysOnTop, Toggle,A
return return
} }
If (GridTop = "Maximize") If (GridTop = "Maximize")
@ -243,22 +243,22 @@ MoveToGrid(GridToMove)
WinRestore,A WinRestore,A
else else
PostMessage, 0x112, 0xF030,,, A, PostMessage, 0x112, 0xF030,,, A,
return return
} }
If (GridTop = "Run") If (GridTop = "Run")
{ {
Run,%GridLeft% ,%GridRight% Run,%GridLeft% ,%GridRight%
return return
} }
if (GridTop = "Restore") if (GridTop = "Restore")
{ {
data := GetWindowState(WindowId) data := GetWindowState(WindowId)
If data If data
{ {
GridLeft := WindowX GridLeft := WindowX
GridRight := WindowX + WindowWidth GridRight := WindowX + WindowWidth
GridTop := WindowY GridTop := WindowY
GridBottom:= WindowY + WindowHeight GridBottom:= WindowY + WindowHeight
WinRestore,A WinRestore,A
WinGetClass,WinClass,A WinGetClass,WinClass,A
@ -280,7 +280,7 @@ MoveToGrid(GridToMove)
GridRight := round(GridRight) GridRight := round(GridRight)
GridBottom := round(GridBottom) GridBottom := round(GridBottom)
GridWidth := GridRight - GridLeft GridWidth := GridRight - GridLeft
GridHeight := GridBottom - GridTop GridHeight := GridBottom - GridTop
WinRestore,A WinRestore,A
@ -320,13 +320,13 @@ DefineHotkeys:
Hotkey, %FastMoveModifiers%Numpad0, WinHotkeys Hotkey, %FastMoveModifiers%Numpad0, WinHotkeys
if FastMoveMeta <> if FastMoveMeta <>
Hotkey, %FastMoveModifiers%%FastMoveMeta%, WinHotkeysMeta Hotkey, %FastMoveModifiers%%FastMoveMeta%, WinHotkeysMeta
return return
WinHotkeys: WinHotkeys:
StringRight,Number,A_ThisHotkey,1 StringRight,Number,A_ThisHotkey,1
MoveToGrid(Number) MoveToGrid(Number)
return return
WinHotkeysMeta: WinHotkeysMeta:
GoSub, ShowGroups GoSub, ShowGroups
@ -344,7 +344,7 @@ WinHotkeysMeta:
GoSub, Command_Hide GoSub, Command_Hide
return return
} }
If FirstNumber is not number If FirstNumber is not number
{ {
If (FirstNumber = "M") If (FirstNumber = "M")
@ -371,7 +371,7 @@ WinHotkeysMeta:
{ {
GoSub, Command_Hide GoSub, Command_Hide
msgbox,NOT DONE!! msgbox,NOT DONE!!
; WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop, ; WinMove, A, ,%WinLeft%,%GridTop%, %WinWidth%,% GridBottom - GridTop,
; StoreWindowState(WindowId,WinLeft,WinTop,WinWidth,WinHeight) ; StoreWindowState(WindowId,WinLeft,WinTop,WinWidth,WinHeight)
return return
} }
@ -389,7 +389,7 @@ WinHotkeysMeta:
GoSub, Command_Hide GoSub, Command_Hide
return return
} }
GoSub, Command_Hide GoSub, Command_Hide
FirstNumber := FirstNumber + 10 FirstNumber := FirstNumber + 10
MoveToGrid(FirstNumber) MoveToGrid(FirstNumber)
@ -442,7 +442,7 @@ MoveToNext:
GridHeight := GridBottom - GridTop GridHeight := GridBottom - GridTop
GridWidth := GridRight - GridLeft GridWidth := GridRight - GridLeft
if (WinTop = GridTop && WinLeft = GridLeft if (WinTop = GridTop && WinLeft = GridLeft
&& WinHeight = GridHeight && WinWidth = GridWidth) && WinHeight = GridHeight && WinWidth = GridWidth)
{ {
current := a_index current := a_index

View File

@ -18,7 +18,7 @@
UseFastMove := True UseFastMove := True
FastMoveModifiers = # FastMoveModifiers = #
Exceptions = QuarkXPress,Winamp v1.x,Winamp PE,Winamp Gen,Winamp EQ,Shell_TrayWnd,32768,Progman,DV2ControlHost Exceptions = QuarkXPress,Winamp v1.x,Winamp PE,Winamp Gen,Winamp EQ,Shell_TrayWnd,32768,Progman,DV2ControlHost
MButtonExceptions = inkscape.exe MButtonExceptions = inkscape.exe
MButtonTimeout = 0.3 MButtonTimeout = 0.3
Transparency = 200 Transparency = 200
SafeMode := True SafeMode := True
@ -75,8 +75,8 @@
Traytip,GridMove,Reading INI,10 Traytip,GridMove,Reading INI,10
;goSub, showOptions ;goSub, showOptions
GetScreenSize() ;get the size of the monitors GetScreenSize() ;get the size of the monitors
GetMonitorSizes() GetMonitorSizes()
RectangleSize := 1 RectangleSize := 1
@ -105,7 +105,7 @@
GroupsShowing := False GroupsShowing := False
EdgeFlag := True EdgeFlag := True
MousePositionLock := False MousePositionLock := False
WM_ENTERSIZEMOVE = 0x231 WM_ENTERSIZEMOVE = 0x231
WM_EXITSIZEMOVE = 0x232 WM_EXITSIZEMOVE = 0x232
@ -113,8 +113,8 @@
WindowX = WindowX =
WindowWidth = WindowWidth =
WindowHeight= WindowHeight=
WindowXBuffer = WindowXBuffer =
WindowYBuffer = WindowYBuffer =
;if DebugMode ;if DebugMode
; Traytip,GridMove,Creating the grid,10 ; Traytip,GridMove,Creating the grid,10
@ -140,7 +140,7 @@
Hotkey, %FastMoveModifiers%Left,MoveToPrevious Hotkey, %FastMoveModifiers%Left,MoveToPrevious
} }
MPFlag := True MPFlag := True
Settimer, MousePosition, 100 Settimer, MousePosition, 100
;Settimer, ReloadOnResolutionChange, 1000 ;Settimer, ReloadOnResolutionChange, 1000
@ -155,7 +155,7 @@
#maxthreadsperhotkey,1 #maxthreadsperhotkey,1
#singleinstance,force #singleinstance,force
#InstallMouseHook #InstallMouseHook
#InstallKeybdHook #InstallKeybdHook
#noenv #noenv
@ -191,7 +191,7 @@ createTrayMenus()
Menu,Tray, Tip, GridMove V%ScriptVersion% Menu,Tray, Tip, GridMove V%ScriptVersion%
Menu,Tray, Add, %tray_updates%, EnableAutoUpdate Menu,Tray, Add, %tray_updates%, EnableAutoUpdate
Menu,Tray, Add, %tray_ignore%, AddToIgnore Menu,Tray, Add, %tray_ignore%, AddToIgnore
if(Registered<>"quebec") if(Registered<>"quebec")
Menu,Tray, Add, %tray_windows%, StartWithWindowsToggle Menu,Tray, Add, %tray_windows%, StartWithWindowsToggle
@ -200,14 +200,14 @@ createTrayMenus()
Menu,Tray,Check, %tray_windows% Menu,Tray,Check, %tray_windows%
else else
Menu,Tray,UnCheck, %tray_windows% Menu,Tray,UnCheck, %tray_windows%
createTemplatesMenu() createTemplatesMenu()
Menu,Tray, Add, %tray_templates%, :templates_menu Menu,Tray, Add, %tray_templates%, :templates_menu
If(NoTrayIcon){ If(NoTrayIcon){
msgbox,here msgbox,here
menu, tray, NoIcon menu, tray, NoIcon
}else{ }else{
IfExist %A_ScriptDir%\Images\gridmove.ico IfExist %A_ScriptDir%\Images\gridmove.ico
Menu,Tray, Icon,%A_ScriptDir%\Images\gridmove.ico Menu,Tray, Icon,%A_ScriptDir%\Images\gridmove.ico
} }
Menu,Tray, NoStandard Menu,Tray, NoStandard
@ -236,14 +236,14 @@ createTemplatesMenu()
} }
Menu,templates_menu,add,, Menu,templates_menu,add,,
Menu,templates_menu, add,%tray_refresh%, RefreshTemplates Menu,templates_menu, add,%tray_refresh%, RefreshTemplates
stringgetpos,out_pos,gridname,\,R1 stringgetpos,out_pos,gridname,\,R1
if out_pos <= 0 if out_pos <= 0
stringgetpos,out_pos,gridname,/,R1 stringgetpos,out_pos,gridname,/,R1
if out_pos <= 0 if out_pos <= 0
return return
stringlen, len, gridname stringlen, len, gridname
StringRight,out_GridName,gridname,% len - out_pos -1 StringRight,out_GridName,gridname,% len - out_pos -1
StringTrimRight,out_GridName2,out_GridName,5 StringTrimRight,out_GridName2,out_GridName,5
IfExist %A_ScriptDir%\Grids\%out_GridName2%.grid IfExist %A_ScriptDir%\Grids\%out_GridName2%.grid
menu,templates_menu,check,%out_GridName2% menu,templates_menu,check,%out_GridName2%
@ -313,7 +313,7 @@ setColorTheme:
createHotkeysMenu() createHotkeysMenu()
{ {
global global
Menu,hotkeys_menu, add, %tray_usecommand%, Hotkeys_UseCommand Menu,hotkeys_menu, add, %tray_usecommand%, Hotkeys_UseCommand
Menu,hotkeys_menu, add, %tray_commandhotkey%, Hotkeys_CommandHotkey Menu,hotkeys_menu, add, %tray_commandhotkey%, Hotkeys_CommandHotkey
Menu,hotkeys_menu, add, %tray_fastmove%, Hotkeys_UseFastMove Menu,hotkeys_menu, add, %tray_fastmove%, Hotkeys_UseFastMove
Menu,hotkeys_menu, add, %tray_fastmovemodifiers%, Hotkeys_FastMoveModifiers Menu,hotkeys_menu, add, %tray_fastmovemodifiers%, Hotkeys_FastMoveModifiers
@ -339,9 +339,9 @@ startWithWindowsQ()
return false return false
} }
;*******************Drop Zone Mode ;*******************Drop Zone Mode
DropZoneMode: DropZoneMode:
DropZoneModeFlag := true DropZoneModeFlag := true
gosub,showgroups gosub,showgroups
Hotkey,RButton,on Hotkey,RButton,on
@ -359,13 +359,13 @@ DropZoneMode:
Hotkey,Esc,off Hotkey,Esc,off
DropZoneModeFlag := false DropZoneModeFlag := false
Critical, off Critical, off
return return
} }
GetKeyState,State,%hotkey%,P GetKeyState,State,%hotkey%,P
If State = U If State = U
break break
MouseGetPos, MouseX, MouseY, window, MouseGetPos, MouseX, MouseY, window,
flagLButton:=true flagLButton:=true
Critical, on Critical, on
@ -377,7 +377,7 @@ DropZoneMode:
TriggerRight := %A_Index%TriggerRight TriggerRight := %A_Index%TriggerRight
TriggerLeft := %A_Index%TriggerLeft TriggerLeft := %A_Index%TriggerLeft
If (MouseY >= TriggerTop AND MouseY <= TriggerBottom If (MouseY >= TriggerTop AND MouseY <= TriggerBottom
AND MouseX <= TriggerRight AND MouseX >= TriggerLeft) AND MouseX <= TriggerRight AND MouseX >= TriggerLeft)
{ {
GetGrid(A_Index) GetGrid(A_Index)
@ -395,7 +395,7 @@ DropZoneMode:
GridLeft := GetMonitorLeft(MouseX,MouseY) GridLeft := GetMonitorLeft(MouseX,MouseY)
GridWidth := GetMonitorRight(MouseX,MouseY) - GetMonitorLeft(MouseX,MouseY) GridWidth := GetMonitorRight(MouseX,MouseY) - GetMonitorLeft(MouseX,MouseY)
GridHeight := GetMonitorBottom(MouseX,MouseY) - GetMonitorTop(MouseX,MouseY) GridHeight := GetMonitorBottom(MouseX,MouseY) - GetMonitorTop(MouseX,MouseY)
} }
If not canceled If not canceled
{ {
@ -417,8 +417,8 @@ DropZoneMode:
Critical, off Critical, off
if flagLButton if flagLButton
hideGui2() hideGui2()
} }
DropZoneModeFlag := false DropZoneModeFlag := false
Gui,2:Hide Gui,2:Hide
Hotkey,RButton,off Hotkey,RButton,off
Hotkey,Esc,off Hotkey,Esc,off
@ -435,16 +435,16 @@ hideGui2()
Gui,2: +ToolWindow +AlwaysOnTop -Disabled -SysMenu Gui,2: +ToolWindow +AlwaysOnTop -Disabled -SysMenu
Gui,2: Show, x-10000 y-10000 w0 h0 NoActivate,% A_SPACE Gui,2: Show, x-10000 y-10000 w0 h0 NoActivate,% A_SPACE
} }
cancel: cancel:
if not canceled if not canceled
{ {
canceled := True canceled := True
GoSub, HideGroups GoSub, HideGroups
Gui,2:Hide Gui,2:Hide
} }
return return
;*******************Mbutton method ;*******************Mbutton method
MButtonMove: MButtonMove:
@ -502,7 +502,7 @@ MousePosition:
return return
KeyWait, LButton,U KeyWait, LButton,U
KeyWait, LButton,D KeyWait, LButton,D
SetBatchLines, -1 SetBatchLines, -1
@ -513,7 +513,7 @@ MousePosition:
WinGetPos,WinLeft,WinTop,WinWidth,WinHeight,ahk_id%MouseWin% WinGetPos,WinLeft,WinTop,WinWidth,WinHeight,ahk_id%MouseWin%
WinGet,WinStyle,Style,ahk_id %mousewin% WinGet,WinStyle,Style,ahk_id %mousewin%
WinGet,WindowId,Id,ahk_id %mousewin% WinGet,WindowId,Id,ahk_id %mousewin%
If Winclass in %Exceptions% If Winclass in %Exceptions%
{ {
Settimer, MousePosition,10 Settimer, MousePosition,10
@ -540,20 +540,20 @@ MousePosition:
AND (MouseControl = "" OR DisableTitleButtonsDetection)) AND (MouseControl = "" OR DisableTitleButtonsDetection))
{ {
Hotkey = LButton Hotkey = LButton
sendinput {LButton up} sendinput {LButton up}
GoSub,DropZoneMode GoSub,DropZoneMode
Settimer, MousePosition,10 Settimer, MousePosition,10
return return
} }
} }
else else
{ {
If (LButtonDrag AND OldmouseX > TitleLeft If (LButtonDrag AND OldmouseX > TitleLeft
AND OldMouseX < TitleLeft + 20 AND WinWidth > 170 AND OldMouseX < TitleLeft + 20 AND WinWidth > 170
AND (MouseControl = "" OR DisableTitleButtonsDetection)) AND (MouseControl = "" OR DisableTitleButtonsDetection))
{ {
Hotkey = LButton Hotkey = LButton
sendinput {LButton up} sendinput {LButton up}
GoSub,DropZoneMode GoSub,DropZoneMode
Settimer, MousePosition,10 Settimer, MousePosition,10
return return
@ -586,7 +586,7 @@ MousePosition:
EdgeFlagFound := false EdgeFlagFound := false
loop,%RectangleCount% loop,%RectangleCount%
{ {
if(mouseX >= EdgeRectangleXL%A_Index% && mouseX <= EdgeRectangleXR%A_Index% if(mouseX >= EdgeRectangleXL%A_Index% && mouseX <= EdgeRectangleXR%A_Index%
&& mouseY >= EdgeRectangleYT%A_Index% && mouseY <= EdgeRectangleYB%A_Index%) && mouseY >= EdgeRectangleYT%A_Index% && mouseY <= EdgeRectangleYB%A_Index%)
{ {
EdgeFlagFound := true EdgeFlagFound := true
@ -643,7 +643,7 @@ SnapWindow:
GridTop :=0 GridTop :=0
GridLeft :=0 GridLeft :=0
If (MouseY >= triggerTop AND MouseY <= triggerBottom If (MouseY >= triggerTop AND MouseY <= triggerBottom
AND MouseX <= triggerRight AND MouseX >= triggerLeft) AND MouseX <= triggerRight AND MouseX >= triggerLeft)
{ {
@ -651,7 +651,7 @@ SnapWindow:
If GridTop = AlwaysOnTop If GridTop = AlwaysOnTop
{ {
WinSet, AlwaysOnTop, Toggle,A WinSet, AlwaysOnTop, Toggle,A
return return
} }
If GridTop = Maximize If GridTop = Maximize
@ -661,12 +661,12 @@ SnapWindow:
WinRestore,A WinRestore,A
else else
PostMessage, 0x112, 0xF030,,, A, PostMessage, 0x112, 0xF030,,, A,
return return
} }
If GridTop = Run If GridTop = Run
{ {
Run,%GridLeft% ,%GridRight% Run,%GridLeft% ,%GridRight%
return return
} }
WinRestore,A WinRestore,A
@ -683,7 +683,7 @@ SnapWindow:
if ShouldUseSizeMoveMessage(WinClass) if ShouldUseSizeMoveMessage(WinClass)
SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid% SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid%
break break
} }
} }
If Moved If Moved
StoreWindowState(WindowID,WinLeft,WinTop,WinWidth,WinHeight) StoreWindowState(WindowID,WinLeft,WinTop,WinWidth,WinHeight)
@ -693,9 +693,9 @@ return
GetGrid(number) GetGrid(number)
{ {
global global
MouseGetPos, MouseX, MouseY, window, MouseGetPos, MouseX, MouseY, window,
GridTop := %number%GridTop GridTop := %number%GridTop
GridBottom := %number%GridBottom GridBottom := %number%GridBottom
GridRight := %number%GridRight GridRight := %number%GridRight
@ -719,7 +719,7 @@ GetGrid(number)
GridTop := MonitorTop GridTop := MonitorTop
GridBottom := GridTop + WinHeight GridBottom := GridTop + WinHeight
} }
If GridLeft = WindowWidth If GridLeft = WindowWidth
{ {
MonitorRight := GetMonitorRight(MouseX, MouseY) MonitorRight := GetMonitorRight(MouseX, MouseY)
@ -729,25 +729,25 @@ GetGrid(number)
GridLeft := MonitorRight - WinWidth GridLeft := MonitorRight - WinWidth
If (GridLeft < MonitorLeft) If (GridLeft < MonitorLeft)
GridLeft := MonitorLeft GridLeft := MonitorLeft
GridRight := GridLeft + WinWidth GridRight := GridLeft + WinWidth
} }
If GridTop = restore If GridTop = restore
{ {
data := GetWindowState(WindowID) data := GetWindowState(WindowID)
If data If data
{ {
GridLeft := WindowX GridLeft := WindowX
GridRight := WindowX + WindowWidth GridRight := WindowX + WindowWidth
GridTop := WindowY GridTop := WindowY
GridBottom := WindowY + WindowHeight GridBottom := WindowY + WindowHeight
} }
else else
{ {
GridLeft := WinLeft GridLeft := WinLeft
GridRight := WinLeft + WinWidth GridRight := WinLeft + WinWidth
GridTop := WinTop GridTop := WinTop
GridBottom := WinTop + WinHeight GridBottom := WinTop + WinHeight
} }
} }
@ -771,7 +771,7 @@ GetGrid(number)
else else
GridBottom := round(GridBottom) GridBottom := round(GridBottom)
GridWidth := GridRight - GridLeft GridWidth := GridRight - GridLeft
GridHeight := GridBottom - GridTop GridHeight := GridBottom - GridTop
} }
@ -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
TriggerHeight := TriggerBottom - TriggerTop TriggerRight := %PosIndex%TriggerRight - ScreenLeft
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
@ -855,22 +856,22 @@ creategroups:
Gui, add, Picture, Y%tempBottom% X%tempLeft% W%tempWidth% H3 ,%A_ScriptDir%\Images\%horizontalGrid% Gui, add, Picture, Y%tempBottom% X%tempLeft% W%tempWidth% H3 ,%A_ScriptDir%\Images\%horizontalGrid%
Gui, add, Picture, Y%tempTop% X%tempLeft% W3 H%tempHeight% ,%A_ScriptDir%\Images\%verticalGrid% Gui, add, Picture, Y%tempTop% X%tempLeft% W3 H%tempHeight% ,%A_ScriptDir%\Images\%verticalGrid%
Gui, add, Picture, Y%tempTop% X%tempRight% W3 H%tempHeight% ,%A_ScriptDir%\Images\%verticalGrid% Gui, add, Picture, Y%tempTop% X%tempRight% W3 H%tempHeight% ,%A_ScriptDir%\Images\%verticalGrid%
shadowleft := textleft + 1 shadowleft := textleft + 1
shadowtop := texttop + 1 shadowtop := texttop + 1
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%
} }
@ -890,7 +891,7 @@ creategroups:
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreUndoShadow% Y%ShadowTop% ,%A_Index%-Undo Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreUndoShadow% Y%ShadowTop% ,%A_Index%-Undo
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreUndo% Y%TextTop% ,%A_Index%-Undo Gui, add, text,c%textcolor% BackGroundTrans X%RestoreUndo% Y%TextTop% ,%A_Index%-Undo
} }
If GridTop = Maximize If GridTop = Maximize
{ {
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%A_Index%-Maximize Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,%A_Index%-Maximize
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%A_Index%-Maximize Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,%A_Index%-Maximize
@ -908,7 +909,7 @@ creategroups:
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreUndoShadow% Y%ShadowTop% ,Undo Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreUndoShadow% Y%ShadowTop% ,Undo
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreUndo% Y%TextTop% ,Undo Gui, add, text,c%textcolor% BackGroundTrans X%RestoreUndo% Y%TextTop% ,Undo
} }
If GridTop = Maximize If GridTop = Maximize
{ {
Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,Maximize Gui, add, text,c%shadowcolor% BackGroundTrans X%RestoreLeftShadow% Y%ShadowTop% ,Maximize
Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,Maximize Gui, add, text,c%textcolor% BackGroundTrans X%RestoreLeft% Y%TextTop% ,Maximize
@ -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%
@ -968,14 +969,14 @@ creategroups:
Gui,2: +ToolWindow +AlwaysOnTop -Disabled -SysMenu -Caption Gui,2: +ToolWindow +AlwaysOnTop -Disabled -SysMenu -Caption
Gui,2: Margin,0,0 Gui,2: Margin,0,0
} }
else else
{ {
Gui,2: Color, 0 Gui,2: Color, 0
Aero_ChangeFrameAreaAll(gui2hwnd) ;call the Function Aero_ChangeFrameAreaAll(gui2hwnd) ;call the Function
} }
Gui,hide Gui,hide
return return
;***********************************************************Aditional Functions ;***********************************************************Aditional Functions
ExitProgram: ExitProgram:
@ -1036,7 +1037,7 @@ Options_GridOrder:
GridOrder := input GridOrder := input
GoSub, WriteIni GoSub, WriteIni
return return
Options_LButtonDrag: Options_LButtonDrag:
If LButtonDrag If LButtonDrag
{ {
@ -1061,7 +1062,7 @@ Options_mbuttonDrag:
GoSub, WriteIni GoSub, WriteIni
reload reload
return return
Options_EdgeDrag: Options_EdgeDrag:
If EdgeDrag If EdgeDrag
{ {
@ -1076,7 +1077,7 @@ Options_EdgeDrag:
Menu,options_menu,Enable, %tray_edgetime% Menu,options_menu,Enable, %tray_edgetime%
} }
GoSub, WriteIni GoSub, WriteIni
return return
Options_EdgeTime: Options_EdgeTime:
inputbox,input, %input_edgetime_title%,%input_edgetime%,,,,,,,,%EdgeTime% inputbox,input, %input_edgetime_title%,%input_edgetime%,,,,,,,,%EdgeTime%
@ -1085,15 +1086,15 @@ Options_EdgeTime:
EdgeTime := input EdgeTime := input
GoSub, WriteIni GoSub, WriteIni
return return
Options_TitleSize: Options_TitleSize:
inputbox,input, %input_titlesize_title%,%input_titlesize%,,,,,,,,%TitleSize% inputbox,input, %input_titlesize_title%,%input_titlesize%,,,,,,,,%TitleSize%
if errorlevel <> 0 if errorlevel <> 0
return return
TitleSize := input TitleSize := input
GoSub, WriteIni GoSub, WriteIni
return return
Options_SafeMode: Options_SafeMode:
if SafeMode if SafeMode
{ {
@ -1114,7 +1115,7 @@ Options_ShowGrid:
ShowGroupsFlag := false ShowGroupsFlag := false
Menu,options_menu, Uncheck, %tray_showgrid% Menu,options_menu, Uncheck, %tray_showgrid%
Menu,options_menu,Disable, %tray_shownumbers% Menu,options_menu,Disable, %tray_shownumbers%
} }
else else
{ {
ShowGroupsFlag := True ShowGroupsFlag := True
@ -1122,14 +1123,14 @@ Options_ShowGrid:
Menu,options_menu,Enable, %tray_shownumbers% Menu,options_menu,Enable, %tray_shownumbers%
} }
GoSub, WriteIni GoSub, WriteIni
return return
Options_ShowNumbers: Options_ShowNumbers:
If ShowNumbersFlag If ShowNumbersFlag
{ {
ShowNumbersFlag := false ShowNumbersFlag := false
Menu,options_menu, Uncheck, %tray_shownumbers% Menu,options_menu, Uncheck, %tray_shownumbers%
} }
else else
{ {
ShowNumbersFlag := True ShowNumbersFlag := True
@ -1137,7 +1138,7 @@ Options_ShowNumbers:
} }
GoSub, WriteIni GoSub, WriteIni
Reload Reload
return return
Template-Grids: Template-Grids:
GridName = Grids/%A_ThisMenuItem%.grid GridName = Grids/%A_ThisMenuItem%.grid
@ -1163,11 +1164,11 @@ NextGrid:
break break
} }
} }
Loop, Parse,GridOrder,CSV Loop, Parse,GridOrder,CSV
{ {
If A_LoopField is space If A_LoopField is space
continue continue
If NextGridFlag If NextGridFlag
{ {
NextGrid := A_LoopField NextGrid := A_LoopField
@ -1181,7 +1182,7 @@ NextGrid:
If (NextGridFlag OR NextGrid = "") If (NextGridFlag OR NextGrid = "")
{ {
StringGetPos, CommaPosition, GridOrder, `, StringGetPos, CommaPosition, GridOrder, `,
StringLeft, NextGrid, GridOrder, %CommaPosition% StringLeft, NextGrid, GridOrder, %CommaPosition%
} }
GridName = Grids/%NextGrid%.grid GridName = Grids/%NextGrid%.grid
Critical,on Critical,on
@ -1195,7 +1196,7 @@ return
ApplyGrid: ApplyGrid:
If (GridName = "4part") If (GridName = "4part")
GridName = Grids/4-Part.grid GridName = Grids/4-Part.grid
if (GridName = "edge") if (GridName = "edge")
GridName = Grids/EdgeGrid.grid GridName = Grids/EdgeGrid.grid
if (Gridname = "DualScreen") if (Gridname = "DualScreen")
@ -1210,11 +1211,11 @@ ApplyGrid:
else else
GoSub, CreateGridFromFile GoSub, CreateGridFromFile
return return
; RegisterGridTile()
CreateGridFromFile: CreateGridFromFile:
Menu,templates_menu,DeleteAll Menu,templates_menu,DeleteAll
createTemplatesMenu() createTemplatesMenu()
GoSub, HideGroups GoSub, HideGroups
Gui,destroy Gui,destroy
Gui,2:destroy Gui,2:destroy
@ -1224,33 +1225,41 @@ CreateGridFromFile:
MsgBox,%error_ngroups% %GridName% MsgBox,%error_ngroups% %GridName%
GoSub, Template-3Part GoSub, Template-3Part
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
}
GridTop = %A_Index%GridTop %A_Index%PosNum = %PosIndex%
GridBottom = %A_Index%GridBottom TriggerTop = %PosIndex%TriggerTop
GridRight = %A_Index%GridRight TriggerBottom = %PosIndex%TriggerBottom
GridLeft = %A_Index%GridLeft TriggerRight = %PosIndex%TriggerRight
TriggerLeft = %PosIndex%TriggerLeft
GridTop = %PosIndex%GridTop
GridBottom = %PosIndex%GridBottom
GridRight = %PosIndex%GridRight
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
IniRead,%TriggerLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerLeft,Error IniRead,%TriggerLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerLeft,Error
IniRead,%TriggerRight% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerRight,Error IniRead,%TriggerRight% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerRight,Error
IniRead,%GridTop% ,%A_ScriptDir%\%GridName%,%A_Index%,GridTop,Error IniRead,%GridTop% ,%A_ScriptDir%\%GridName%,%A_Index%,GridTop,Error
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" )
{ {
ErrorCode := A_Index ErrorCode := A_Index
@ -1281,13 +1290,13 @@ return
GetScreenSize() GetScreenSize()
{ {
Global Global
ScreenLeft :=0 ScreenLeft :=0
ScreenTop :=0 ScreenTop :=0
ScreenRight :=0 ScreenRight :=0
ScreenBottom :=0 ScreenBottom :=0
Sysget,MonitorCount,MonitorCount Sysget,MonitorCount,MonitorCount
Loop,%MonitorCount% Loop,%MonitorCount%
{ {
SysGet,monitor,Monitor,%A_Index% SysGet,monitor,Monitor,%A_Index%
@ -1301,7 +1310,7 @@ GetScreenSize()
ScreenBottom:=monitorBottom ScreenBottom:=monitorBottom
} }
ScreenWidth := ScreenRight - ScreenLeft ScreenWidth := ScreenRight - ScreenLeft
ScreenHeight := ScreenBottom - ScreenTop ScreenHeight := ScreenBottom - ScreenTop
return return
} }
@ -1311,7 +1320,7 @@ GetMonitorRight(MouseX, MouseY)
Loop,%monitorcount% Loop,%monitorcount%
{ {
SysGet,monitor,Monitor,%A_Index% SysGet,monitor,Monitor,%A_Index%
If (MouseX <= monitorRight AND MouseX >= monitorLeft If (MouseX <= monitorRight AND MouseX >= monitorLeft
AND MouseY >= monitorTop AND MouseY <= monitorBottom) AND MouseY >= monitorTop AND MouseY <= monitorBottom)
return %MonitorRight% return %MonitorRight%
} }
@ -1324,33 +1333,33 @@ GetMonitorBottom(MouseX, MouseY)
Loop,%monitorcount% Loop,%monitorcount%
{ {
SysGet,monitor,Monitor,%A_Index% SysGet,monitor,Monitor,%A_Index%
If (MouseX <= MonitorRight AND MouseX >= MonitorLeft If (MouseX <= MonitorRight AND MouseX >= MonitorLeft
AND MouseY >= monitorTop AND MouseY <= monitorBottom) AND MouseY >= monitorTop AND MouseY <= monitorBottom)
return, %MonitorBottom% return, %MonitorBottom%
} }
return error return error
} }
GetMonitorLeft(MouseX, MouseY) GetMonitorLeft(MouseX, MouseY)
{ {
SysGet,monitorcount,MonitorCount SysGet,monitorcount,MonitorCount
Loop,%monitorcount% Loop,%monitorcount%
{ {
SysGet,monitor,Monitor,%A_Index% SysGet,monitor,Monitor,%A_Index%
If (MouseX <= MonitorRight AND MouseX >= MonitorLeft If (MouseX <= MonitorRight AND MouseX >= MonitorLeft
AND MouseY >= monitorTop AND MouseY <= monitorBottom) AND MouseY >= monitorTop AND MouseY <= monitorBottom)
return, %MonitorLeft% return, %MonitorLeft%
} }
return error return error
} }
GetMonitorTop(MouseX, MouseY) GetMonitorTop(MouseX, MouseY)
{ {
SysGet,monitorcount,MonitorCount SysGet,monitorcount,MonitorCount
Loop,%monitorcount% Loop,%monitorcount%
{ {
SysGet,monitor,Monitor,%A_Index% SysGet,monitor,Monitor,%A_Index%
If (MouseX <= MonitorRight AND MouseX >= MonitorLeft If (MouseX <= MonitorRight AND MouseX >= MonitorLeft
AND MouseY >= monitorTop AND MouseY <= monitorBottom) AND MouseY >= monitorTop AND MouseY <= monitorBottom)
return, %MonitorTop% return, %MonitorTop%
} }
@ -1371,7 +1380,7 @@ StoreWindowState(WindowID,WindowX,WindowY,WindowWidth,WindowHeight)
WindowHeightBuffer = %WindowHeight%,%WindowHeightBuffer% WindowHeightBuffer = %WindowHeight%,%WindowHeightBuffer%
return return
} }
GetWindowState(WindowId) GetWindowState(WindowId)
{ {
global global
@ -1383,7 +1392,7 @@ GetWindowState(WindowId)
{ {
if a_loopfield is space if a_loopfield is space
continue continue
if (WindowId = A_LoopField) if (WindowId = A_LoopField)
{ {
WindowX := WindowX%A_Index% WindowX := WindowX%A_Index%
WindowY := WindowY%A_Index% WindowY := WindowY%A_Index%
@ -1392,7 +1401,7 @@ GetWindowState(WindowId)
return true return true
} }
} }
return false return false
} }
evaluateGrid() evaluateGrid()
@ -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
@ -1441,9 +1452,9 @@ evaluateGrid()
Getmonitorsizes() Getmonitorsizes()
{ {
global global
sysget,monitorCount,MonitorCount sysget,monitorCount,MonitorCount
loop,%monitorCount% loop,%monitorCount%
{ {
sysget,monitorReal,Monitor,%A_Index% sysget,monitorReal,Monitor,%A_Index%
@ -1454,20 +1465,20 @@ Getmonitorsizes()
monitor%a_Index%Top :=MonitorTop monitor%a_Index%Top :=MonitorTop
monitor%a_Index%Width :=MonitorRight - MonitorLeft monitor%a_Index%Width :=MonitorRight - MonitorLeft
monitor%a_Index%Height :=MonitorBottom - MonitorTop monitor%a_Index%Height :=MonitorBottom - MonitorTop
monitorreal%A_Index%Left :=MonitorRealLeft monitorreal%A_Index%Left :=MonitorRealLeft
monitorreal%A_Index%Bottom :=MonitorRealBottom monitorreal%A_Index%Bottom :=MonitorRealBottom
monitorreal%A_Index%Right :=MonitorRealRight monitorreal%A_Index%Right :=MonitorRealRight
monitorreal%A_Index%Top :=MonitorRealTop monitorreal%A_Index%Top :=MonitorRealTop
monitorreal%A_Index%Width :=MonitorRealRight - MonitorRealLeft monitorreal%A_Index%Width :=MonitorRealRight - MonitorRealLeft
monitorreal%A_Index%Height :=MonitorRealBottom - MonitorRealTop monitorreal%A_Index%Height :=MonitorRealBottom - MonitorRealTop
} }
return return
} }
ComputeEdgeRectangles() ComputeEdgeRectangles()
{ {
global global
sysget,MonitorCount,MonitorCount sysget,MonitorCount,MonitorCount
@ -1540,7 +1551,7 @@ StartWithWindowsToggle:
return return
EnableAutoUpdate: EnableAutoUpdate:
; Register with DcUpdater and check for updates. ; Register with DcUpdater and check for updates.
; When no updates are found nothing is displayed. ; When no updates are found nothing is displayed.
; make sure the dcuhelper.exe is in a subdirectory called 'dcuhelper' of this script's location. ; make sure the dcuhelper.exe is in a subdirectory called 'dcuhelper' of this script's location.
cmdParams = -ri ;r = register app, i = check for updates cmdParams = -ri ;r = register app, i = check for updates
@ -1610,7 +1621,7 @@ loadAero()
return true return true
} }
#include files.ahk #include files.ahk
#include command.ahk #include command.ahk
#include calc.ahk #include calc.ahk