Language Guide

183
CHAPTER 7
Control Statements 7
Figure 7-0
Listing 7-0
Table 7-0
Control statements are statements that control when and how other statements
are executed. Most control statements are compound statements—that is,
statements that contain other statements.
By default, AppleScript executes the statements in a script in sequence, one
after the other. Control statements can change the order in which AppleScript
executes statements by causing AppleScript to repeat or skip statements or go
to a different statement.
This chapter describes the following control statements:
Tell, which defines the default target to which commands are sent if no
direct object is specified
If, which allows you to execute or skip statements based on the outcome of
one or more tests
Repeat, which allows you to repeat a series of statements
Try, which allows you to handle error messages
Considering and Ignoring, which allow you to consider or ignore certain
attributes, such as case, punctuation, and white space, in string comparisons
With Timeout, which allows you to specify how long AppleScript waits for
an application command or scripting addition to complete before stopping
execution of the script and returning an error
With Transaction, which allows you to take advantage of applications that
support the notion of a transaction—a sequence of related events that should
be performed as if they were a single operation