Sign in to follow this  
Followers 0
RocTx

Capturing Button Pressed in a MsgBox

6 posts in this topic

I need a nudge...

How do you capture or determine what button was pressed in a MsgBox scenario.

In the following code the flag 4131 produces a "Yes" "No" "Cancel" button.

MsgBox (4131, "Accept?", "Is this Correct?" & @CRLF & @CRLF & ReadInput())

How do I determine which one was pressed?

Thanks

Share this post


Link to post
Share on other sites



Take a look here.

Alzo


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Thanks for the reply Alzo.. I've been there in that same page staring at it.. but I can't see "how" to determine which button was pressed, hence my question. What $variable or @function is the result in, that I can use to query or display what button was pressed?

RocTx

Share this post


Link to post
Share on other sites

You could try this to see:

ConsoleWrite('You Pressed: ' & MsgBox (4131, "Accept?", "Is this Correct?" & @CRLF & @CRLF) & @LF)oÝ÷ Û®öÌ!jÒ ¢Û(jëh×6Switch MsgBox (4131, "Accept?", "Is this Correct?" & @CRLF & @CRLF)
    Case 2
        MsgBox(64, 'Info:', 'You pressed Cancel')
    Case 6
        MsgBox(64, 'Info:', 'You Pressed Yes')
    Case 7
        MsgBox(64, 'Info:', 'You pressed No')
EndSwitch

[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 for your reply SmOke_N,

Your "Switch" code did not work for me. First it complained about not having "Select".

Then when I added select it complained with a "syntax" error with "Switch".

But from looking and using your example with "ConsoleWrite" I was able to code it as the following code

and that worked!

$Pressed=MsgBox (4131, "Accept?", "Is this Correct?" & @CRLF & @CRLF & ReadInput())
            MsgBox(4096,"Pressed", "You Pressed " & $Pressed)

Thanks again..

RocTx

Share this post


Link to post
Share on other sites

Thanks for your reply SmOke_N,

Your "Switch" code did not work for me. First it complained about not having "Select".

Then when I added select it complained with a "syntax" error with "Switch".

But from looking and using your example with "ConsoleWrite" I was able to code it as the following code

and that worked!

$Pressed=MsgBox (4131, "Accept?", "Is this Correct?" & @CRLF & @CRLF & ReadInput())
            MsgBox(4096,"Pressed", "You Pressed " & $Pressed)

Thanks again..

RocTx

You have to have Beta to use Switch. Sorry, I saw how long you had been on the forum, and assumed you would have known that.

[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

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