Sign in to follow this  
Followers 0
Matthew VanDerlofske

Msgbox

3 posts in this topic

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



#2 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks

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  
Followers 0