Jump to content
Sign in to follow this  
suplada

cancel option in msgbox

Recommended Posts

suplada

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!

Share this post


Link to post
Share on other sites
Mobius

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
  • Like 1

wtfpl-badge-1.png

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  

×