Scripts run forever until they call
Consider the following example:
Framework.Ask("Are you sure?", function (Msg) {
// Called asynchronously by the framework
});
Framework.EndScript();
This won't work. The script will create the ask dialog, but then immediately terminate (also destroying the dialog) before it has got a response. This script should instead be written as follows:
Framework.Ask("Are you sure?", function (Msg) {
// Called asynchronously by the framework
// … do something based on the user's response
// And, finally, tell the framework that we're done
Framework.EndScript();
});
// When execution gets here, we're waiting for the user's response to the Ask().
// We don't want to terminate.