How to stop and exit the entire script?

Another question I have is how to exit my script?

For example:

Statement 1
if (condition 1)
stop and exit the entire script
end if
Statement 2



A good way to exit your script is to use Exit All. This can be found in the SenseTalk Reference manual.


Thanks for your reply Elizabeth.

An additional question I have is:
When I Exit All, how do I fail the script?

In other words, how do I make the Status of ScriptResults() function to be “Failure” instead of “Success”?


If you want to have the script fail and then end the script, you can log an error before you use exit all. LogError causes the script to fail but does not itself end the script.

logerror "fail this script"
exit all 


Using ExitAll I know I can exit the script I’m currently running, but if its nested, will it also stop all of the other scripts running? Also, if I throw an answer before halting the script, will it still display after the script has stopped?

The Exit All command will end script execution altogether, regardless of how deeply nested the handler is, or whether there are any Try blocks in effect, etc. You can use a Log or Put command to display a value before exiting if you like.

If you use a Throw command to throw an exception before the Exit All command, then the Exit All will not be executed. If there are no Try blocks in effect to catch the exception then this will also halt execution.