Jump to content

cancel option in msgbox


suplada
 Share

Recommended Posts

Hi Guys!

I used a Msgbox with "1" flag in my script, but when I ran the script and clicked on the Cancel button, the script continues to be executed. How can I cancel the script by clicking on the cancel button?

Really need help!

Thanks!

Link to comment
Share on other sites

Yo suplada,

Try This::

$MsgRet = MsgBox(1,"Hello "& @USERNAME,"Would you like to continue?")
IF $MsgRet = 2 THEN EXIT
MsgBox(0,"","You clicked ok")

If you check out the helpfile on MsgBox() You will see that the cancel button returns with a msg code of 2.

By allocating a variable to the return value of MsgBox, you can retrieve and use these msg codes.

Vlad

Edited by Mobius

wtfpl-badge-1.png

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...