Sign in to follow this  
Followers 0
polara

Exit script if Cancel

5 posts in this topic

How can I get a script to stop running and exit if Cancel is clicked in a Message Box?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

In the help file, look up msgbox. There is a list of number codes used for the cancel, abort, retry etc. buttons.

$msg = messagebox(64;<-- icon, but can also be the cancel, abort, retry buttons, "Title","Body")

if $msg = 2(Cancel) then

exit

endif

Edited by eynstyne

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

In the help file, look up msgbox. There is a list of number codes used for the cancel, abort, retry etc. buttons.

$msg = messagebox(64;<-- icon, but can also be the cancel, abort, retry buttons, "Title","Body")

if $msg = 2(Cancel) then

exit

endif

Well, I did consult the Help file but couldn't figure out how to proceed. That's why the post. What I am trying to make happen is this:

MsgBox(1, "Test for ok or cancel", "Click OK to continue. Click Cancel to stop this script.")

If Ok was clicked I want to get this:

MsgBox(0,"You must have clicked Ok.")

If Cancel was clicked I want to get this:

MsgBox(0,"You must have clicked Cancel. Bye Bye!")

Thanks.

Share this post


Link to post
Share on other sites

$MsgBox = MsgBox(1, "Test for ok or cancel", "Click OK to continue. Click Cancel to stop this script.")

If $MsgBox = 1 Then
    MsgBox(0, "", "You must have clicked Ok.")
Else
    MsgBox(0, "", "You must have clicked Cancel. Bye Bye!")
EndIf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

HI,

look into help. It must be there :-)

$var = MsgBox(1, "Test for ok or cancel", "Click OK to continue. Click Cancel to stop this script.")

If $var = 1 Then
    MsgBox(0, "info", "You must have clicked Ok.")
Else
    MsgBox(0, "info", "You must have clicked Cancel. Bye Bye!")
EndIf

Edit: a bit late. Damn! :-)

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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