Gui MsgBox that waits before continuing

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
roysubs
Posts: 428
Joined: 29 Sep 2018, 16:37

Gui MsgBox that waits before continuing

21 Nov 2018, 06:47

Here is discussed a Gui that does not block the flow of the script.
https://autohotkey.com/board/topic/9256 ... he-script/

Could you tell me how to do the opposite please? i.e. The same Gui as above, but that pauses and waits for Ok to be pressed before continuing the script?
Portwolf
Posts: 161
Joined: 08 Oct 2018, 12:57

Re: Gui MsgBox that waits before continuing

21 Nov 2018, 07:23

If MsgBox is presented with no options, script does not move until it's pressed.
Was that it?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Gui MsgBox that waits before continuing

21 Nov 2018, 08:03

without Pause:

Code: Select all

#NoEnv
#SingleInstance Force
CoordMode ToolTip

global xMid := A_ScreenWidth // 2 - 50
global yMid := A_ScreenHeight // 2

Hotkey F1, Quit, P-1

global breakLoop := false
Loop
{
	if breakLoop
		break

	ToolTip % "Iteration: " A_Index, xMid, yMid - 100
	showGui()
}
MsgBox Broken. Exiting.
ExitApp

Quit:
	ExitApp
return

showGui() {
	static HWND := makeGui()
	Gui MyGui:Show, w200
	WinWaitClose % "ahk_id " HWND
}

makeGui() {
	Gui MyGui:New, +Hwndhwnd, MyGui
	Gui Add, Text, , Paused Execution
	Gui Add, Button, , Dismiss Gui
	Gui Add, Button, , Break Loop
	
	return hwnd
	
	MyGuiButtonDismissGui:
		Loop % i := 3
		{
			ToolTip % "Resuming in: " i - A_Index + 1, xMid, yMid + 50, 2
			Sleep 1000
		}

		ToolTip, , , , 2
		Gui MyGui:Submit
	Return

	MyGuiButtonBreakLoop:
		breakLoop := true
		Gui MyGui:Submit
	Return
}
but u need to make sure hotkeys and subroutines(Thread Priority) are run with a priority lower than the default one
roysubs
Posts: 428
Joined: 29 Sep 2018, 16:37

Re: Gui MsgBox that waits before continuing

21 Nov 2018, 12:15

That's all kind of fascinating and great, thanks swagfag ...

What does the line "Hotkey F1, Quit, P-1" do? P-1??
I think I understand most of it, really great, though it has to be this complex to make a Gui stop and wait?

"but u need to make sure hotkeys and subroutines(Thread Priority) are run with a priority lower than the default one"
How do I do that?

"without Pause:" is it easier with this Pause method?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Joey5 and 174 guests