Code: Select all
;============================================================================;
;---+--- Appending running IDs to an array ---+---;
;============================================================================;
Accounts := []
SetTitleMatchMode, 2
WinGet, Active, List,ahk_exe Notepad.exe
Loop, %Active% {
accountVar := Active%A_index%
Accounts.Push(accountVar)
;MsgBox % Accounts[A_Index] ; This message box shows the IDs of each running client
}
;============================================================================;
;---+--- Organising clients ---+---;
;============================================================================;
x = 3
y = 2
xcount := 0
ycount := 0
sw := A_ScreenWidth
sh := A_ScreenHeight
F2::
Loop, %Active% {
xpos := (sw/x)*(xcount)
ypos := (sh/y)*(ycount)
accountX := Accounts[A_Index]
MsgBox, %xcount%
IF xcount = 3
{
ycount += 1
MsgBox, ycount init %ycount%
xcount := 1
MsgBox, xcount init %xcount%
;MsgBox, %xpos% %ypos% iff
}
WinMove,ahk_id %accountX%,, %xpos%, %ypos%
xcount += 1
MsgBox, %xpos% %ypos%
}
Return