Pausing Script Execution
Script execution can be paused, either to wait for some external condition, or to delay for a specified length of time, using one of the wait statements. You can use the breakpoint command to pause script execution and enter debugging mode.
On this page:
Wait While, Wait Until Commands
Behavior: The wait until command will pause script execution until a given condition occurs or until a particular date/time arrives. If a time is given which is already in the past, execution proceeds immediately. The wait while command waits until a condition is no longer true. In both commands, the condition expression is evaluated repeatedly, and should be an expression whose value will eventually change to the awaited outcome.
Syntax:
wait while condition
wait until condition
wait until timeExpression
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
wait until "12:50 PM"
wait until temperature(hell) < 32
wait while the sound is not done
Wait Command
Behavior: The wait command will pause script execution for a specified length of time. The script simply goes to sleep for the time interval indicated, then wakes up and continues with executing the following statement.
Syntax:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
wait 20 ticks -- 1/3 of a secondwait 2 days 7 hours 14 minutes and 28.6 seconds
wait 3 milliseconds
wait 1.5 -- Assumes seconds, since no unit was specified
Breakpoint Command
Behavior: The breakpoint command, if executed in the context of a debugger, will cause execution of the script to be suspended and control transferred to the debugger. Call breakpoint at any point in your script where you want it to stop for debugging purposes.
Note: The breakpoint command has no effect if the script is running in an environment without a debugger. Breakpoints can also be disabled by setting the breakpointsEnabled global property to False. Setting this property to True again (its default value) will reenable breakpoints.
Syntax:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Example:
if count > upperLimit then breakpoint