Satimage Previous | Next
Pausing execution
Home Documentation Smile AppleScript terminals Using AppleScript in Smile Pausing execution  
Smile's dictionary offers a command to pause scripts, smilepause. You may use smilepause for operational purposes - for instance to poll some other process - and you can also use it in the debugging phase.
smilepause pause_duration

pauses the execution of the script for a duration specified in seconds by pause_duration, a number. While the script is waiting - and unlike with the standard delay command - Smile remains fully responsive: you can use an AppleScript terminal to read a quantity, test an expression, change a variable, and you can launch any script while the first one is suspended.

While the script is suspended in a smilepause instruction, calling the smileresume command resumes execution, pressing the ▸ key (right arrow) resumes execution (if the until arrow key parameter is set to true), and pressing the esc key generates a "User canceled" (number -128) error (if the until escape key parameter is set to true) which, unless the script traps the error, will terminate execution of the script. Thus, it is natural to use smilepause as you would use a breakpoint in a traditional debugger.

If no delay is specified, the script is suspended with no timeout.

Version française
Copyright ©2008 Paris, Satimage