Tente algo assim:
#If WinExist("ahk_exe chrome.exe")
#9:: ; maximize / minimize 1st window in array:
If !WinExist("ahk_id " chrome_array[1])
GoSub, Create_chrome_array
WinGet, WinState, MinMax, % "ahk_id " chrome_array[1]
If WinState = -1
WinMaximize, % "ahk_id " chrome_array[1]
else
WinMinimize, % "ahk_id " chrome_array[1]
return
+#9:: ; maximize / minimize 2nd window in array:
If !WinExist("ahk_id " chrome_array[2])
GoSub, Create_chrome_array
WinGet, WinState, MinMax, % "ahk_id " chrome_array[2]
If WinState = -1
WinMaximize, % "ahk_id " chrome_array[2]
else
WinMinimize, % "ahk_id " chrome_array[2]
return
^#9:: ; maximize / minimize 3rd window in array:
If !WinExist("ahk_id " chrome_array[3])
GoSub, Create_chrome_array
WinGet, WinState, MinMax, % "ahk_id " chrome_array[3]
If WinState = -1
WinMaximize, % "ahk_id " chrome_array[3]
else
WinMinimize, % "ahk_id " chrome_array[3]
return
#If
Create_chrome_array:
; Create an array, initially empty:
chrome_array:= Object()
; Get ID list of all opened chrome windows:
WinGet, ID, list, ahk_exe chrome.exe
Loop, %id% ; retrieves each ID from the list, one at a time
{
this_ID := ID%A_Index%
chrome_array.Push(this_ID) ; Append this_ID to the array
}
return