image

Expressions

image

An expression is a snippet of AppleScript code that has a value. Expressions are evaluated every time the script pauses. This includes the point where the script completes. Expressions are likely to be most useful to you when paused during debugging. However, you can create and edit expressions at any time. Expressions are a feature of a script, and are saved when you save a compiled script.

Important: An expression may refer to local variables — but local variables must be explicitly declared local (with a local statement), or the expression won’t be able to “see” them, and will report that the variable is undefined.

Expressions are created, edited, and displayed in the expressions pane, which is in the same tab as the result pane and the variables pane. To see the expressions pane:

image

To create an expression:

To edit an expression:

To force re-evaluation of an expression:

To remove an expression:

The expressions pane is similar to the variables pane:

Note: Evaluating an expression is like running a little one-line script, and even a little one-line script can do powerful things. An expression that changes a variable’s value, or calls a handler in your script, can be a valid expression and therefore can have side-effects each time it is evaluated.



image
Variables (Debug Mode) Exceptions
image