GuiDestroyAll? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

GuiDestroyAll?

20 Nov 2018, 08:02

I need a GuiDestroyAll() type functionality,tried it myself,but hit a dead end. Any other solutions & why isn't this working?

Code: Select all

Loop 99{
	Gui New
	Gui +AlwaysOnTop
	Gui Show, w100 h100
}

q::GuiDestroyAll()

GuiDestroyAll(){
	Loop 99
		Gui, %A_Index%:Destroy
}

x::
Loop 99
	Gui, %A_Index%:Destroy
Return
live ? long & prosper : regards
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: GuiDestroyAll?

20 Nov 2018, 08:31

I believe you need to set the name at the time of creation ie Gui %A_Index%:New and it should work with what you have.
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: GuiDestroyAll?

20 Nov 2018, 10:53

Code: Select all

Loop 99
	GuiNew()

GuiNew(){
	Static i
	i := i ? (i+1) : 1
	Gui %i%:New
	Gui +AlwaysOnTop
	Gui Show, w100 h100
}

q::GuiDestroyAll()

GuiDestroyAll(){
	Loop 99
		Gui, %A_Index%:Destroy
}
Yup that works, Cheers.
live ? long & prosper : regards
just me
Posts: 9459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: GuiDestroyAll?  Topic is solved

21 Nov 2018, 02:46

Code: Select all

GuiDestroyAll(){
   DHW := A_DetectHiddenWindows
   DetectHiddenWindows, On
   PID := DllCall("GetCurrentProcessId", "UInt")
   WinGet, GuiList, List, ahk_class AutoHotkeyGUI ahk_pid %PID%
   Loop, %GuiList%
      Gui, % GuiList%A_Index% . ":Destroy"
   DetectHiddenWindows, %DHW%
   Return GuiList
}
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: GuiDestroyAll?

21 Nov 2018, 05:28

just me wrote:
21 Nov 2018, 02:46
Exactly what I was looking for,THX DUDE.
live ? long & prosper : regards

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, DaveT1, Descolada, KolaBorat and 170 guests