Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

GuiEscape multiple guis


  • Please log in to reply
5 replies to this topic
Maiph
  • Members
  • 18 posts
  • Last active: Nov 01 2015 01:11 PM
  • Joined: 29 Jul 2015

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?

 

 



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

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





Maiph
  • Members
  • 18 posts
  • Last active: Nov 01 2015 01:11 PM
  • Joined: 29 Jul 2015

what if my gui's are named

gui, foo:

gui, bar: 

...



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012
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.



noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

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


Maiph
  • Members
  • 18 posts
  • Last active: Nov 01 2015 01:11 PM
  • Joined: 29 Jul 2015

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.