So, i have a few guis on my script, and only 1 can be up at a given time. I want to close them with GuiEscape but i don't know how to close them all.
Anyone knows a good way to do this?
So, i have a few guis on my script, and only 1 can be up at a given time. I want to close them with GuiEscape but i don't know how to close them all.
Anyone knows a good way to do this?
example closes all GUI
;- more GUIClosex ;http://ahkscript.org/boards/viewtopic.php?f=9&t=9949 Loop, 4 Gui, %A_Index%: Show, % "x" A_Index * 200 " w150 h80" Return GuiEscape: 2GuiEscape: 3GuiEscape: 4GuiEscape: GuiClose: 2Guiclose: 3GuiClose: 4GuiClose: Loop, 4 Gui, %A_Index%: cancel exitapp
what if my gui's are named
gui, foo:
gui, bar:
...
GuiEscape: 2GuiEscape: FooGuiEscape: BarGuiEscape: GuiClose: 2Guiclose: FooGuiClose: BarGuiClose: Gui, Cancel Gui, 2:Cancel Gui, Foo:Cancel Gui, Bar:Cancel exitapp
If you're naming, then you can't use a loop like above. If you're going to have many GUIs, dozens of them, then there would be a way to do the looping to save some lines by involving an array.
An option would be to add the same label to all GUI (and a handle)
Gui, ab: +LabelMyGui +hwndhwnd1 Gui, ab: Show, w200 h200 Gui, cd: +LabelMyGui +hwndhwnd2 Gui, cd: Show, w200 h200 x100 Gui, ef: +LabelMyGui +hwndhwnd3 Gui, ef: Show, w200 h200 x200 Return MyGuiEscape: loop 3 WinClose,% "ahk_id " hwnd%A_Index% Return
winXP and ahk unicode
i was hoping for something like GuiCloseAll or something like that.
i think i'm just going to do that function and close them all.