Problem with WinwaitClose

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Problem with WinwaitClose

Post by PuzzledGreatly » 24 Oct 2013, 02:48

I have the following code to bring up a settings menu for an AHK game I'm making:

Code: Select all

	~lbutton::
		
			MousegetPos, xpos, ypos 
			if (ypos < 100) and (xpos < 100)
			if (A_PriorHotkey == A_ThisHotkey AND A_TimeSincePriorHotkey < 350) 
			Settings()

	return
I wanted to pause the game so after creating the settings GUI I put:

Code: Select all

	Gui, 10:show, AutoSize, Current Settings
	WinWaitActive, Current Settings ; wait for the 'last found window' (i.e. the Gui) to be active
	WinWaitClose, Current Settings  ; wait for the 'last found window' (i.e. the Gui) to be destroyed
   GoSub Restart
The problem is that if I use WinWaitClose the left mouse click only brings up the Settings Menu once. If I don't use WinWaitClose I can call up the Settings menu multiple times but then I can't pause the game. I've tried setting CoordMode to both screen and active window but it hasn't made a difference. Why does left click stop working if I use WinWaitClose? Thanks

just me
Posts: 9542
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Problem with WinwaitClose

Post by just me » 24 Oct 2013, 03:11

Why should someone call the same settings Gui multiple times?

Edit: Maybe I understand: ; wait for the 'last found window' (i.e. the Gui) to be destroyed. Do you destroy the Gui anywhere in your script?

User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problem with WinwaitClose

Post by PuzzledGreatly » 24 Oct 2013, 05:33

Thanks for the reply. The main Gui is 80. The SettingS Gui is 10. When I go to Restart I destroy Gui 80 and recreate it.

Post Reply

Return to “Ask for Help (v1)”