Jump to content
Sign in to follow this  
Matthew VanDerlofske

Msgbox

Recommended Posts

Matthew VanDerlofske

I know that this is a vary easy question for someone to answer. How do I check what button was pressed when your using a msgbox

Share this post


Link to post
Share on other sites
SmOke_N

The MsgBox() buttons all have values:

Button Pressed Return Value

OK 1

CANCEL 2

ABORT 3

RETRY 4

IGNORE 5

YES 6

NO 7

TRY AGAIN ** 10

CONTINUE ** 11

So, you could do it a couple of ways:

Example:

$Msg_Box = MsgBox(4, 'Continue', 'Do you want to continue?')
If $Msg_Box == 7 Then
    MsgBox(0, 'OK', 'You will be exited now', 2)
    Exit
EndIf

Or another Example:

If MsgBox(4, 'Continue', 'Do you want to continue?') == 7 Then
    MsgBox(0, 'OK', 'You will be exited now', 2)
    Exit
EndIf

Edit: Fixed Code Tag

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.