IfMsgBox

AutoHotkey GUI

IfMsgBox

Checks which button was pushed by the user during the most recent MsgBox command.

IfMsgBox, ButtonName

Parameters

ButtonName

One of the following strings to represent which button the user pressed in the most recent MsgBox command:

Yes
No
OK
Cancel
Abort
Ignore
Retry
Continue [v1.0.44.08+]
TryAgain [v1.0.44.08+]
Timeout (that is, the word "timeout" is present if the MsgBox timed out)

Related

MsgBox

Example

MsgBox, 4, , Would you like to continue?, 5  ; 5-second timeout.
IfMsgBox, No
    Return  ; User pressed the "No" button.
IfMsgBox, Timeout
    Return ; i.e. Assume "No" if it timed out.
; Otherwise, continue:
...