Jump to content

Capturing Button Pressed in a MsgBox


RocTx
 Share

Recommended Posts

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

Link to comment
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

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...