Sign in to follow this  
Followers 0
JohnRichard

How to track what button is pressed in MsgBox control

5 posts in this topic

hi. forgive if i'm out of idea. i just want to track which button is pressed on a message box. then from that button i will execute a command using if and then statement.

say i have this code:

$msg = MsgBox(36, "Exit", "Are you sure you want exit?")
        

    If $msg Then
                
    ....(Statement)
                 Else
                 ....(Statement)

    EndIf

Share this post


Link to post
Share on other sites



hi. forgive if i'm out of idea. i just want to track which button is pressed on a message box. then from that button i will execute a command using if and then statement.

say i have this code:

$msg = MsgBox(36, "Exit", "Are you sure you want exit?")
        

    If $msg Then
                
    ....(Statement)
                 Else
                 ....(Statement)

    EndIf
Hi John,

Try to see in help file the extended error codes of msgbox command

And error doesn't mean BAD errors, there are also good errors ...

cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

Hi again,

$msg = MsgBox(36, "Exit", "Are you sure you want exit?")
        

    if @error = 1 Then;ok button pressed
         Exit      
    Elseif
        continue();other button pressed
    EndIf

And please... stop spaming!


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

thanks november. i was able to check what button is pressed in the help file. there are number values within.

am i really spamming the forum? :P is there a limit for posting in this forum?

Share this post


Link to post
Share on other sites

Hi John,

Try to see in help file the extended error codes of msgbox command

And error doesn't mean BAD errors, there are also good errors ...

cheers

The number is RETURNED from the MsgBox() function, there are no errors. If you provide the optional timeout and no button is pressed before timeout expires, then -1 is returned, but there is still no value in @error.
While 1
    $iRET = MsgBox(36, "Test", "Click YES or NO within 10 seconds...", 10)
    Switch $iRET
        Case - 1
            MsgBox(64, "Results", "Timeout!  Returned value = -1")
        Case 6
            MsgBox(64, "Results", "Yes!  Returned value = 6")
        Case 7
            MsgBox(64, "Results", "No!  Returned value = 7")
        Case Else
            MsgBox(16, "Error!", "Unhandled case!  Returned value = " & $iRET)
    EndSwitch
    If MsgBox(36, "Continue?", "Want to try again?", 10) <> 6 Then ExitLoop
WEnd

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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