Language Guide
CHAPTER 7
Control Statements
With Transaction Statements 219
With Transaction Statements 7
Some applications, such as databases, support the notion of a transaction—
that is, a sequence of related events that should be performed as if they were
a single operation. The With Transaction statement allows you to specify
transactions for such applications.
At the beginning of a With Transaction statement, AppleScript requests a
transaction ID from the target application (established by an enclosing Tell
statement) and attaches that transaction ID to every Apple event it sends to
the target application as a result of executing commands in the body of the
With Transaction statement.
Whenever AppleScript exits a With Transaction statement, it informs the
application that the transaction is over, even if the exit occurs before the end
of the statement because of an error. Thus, if an error occurs within the body
of the With Transaction statement but is not handled within the statement,
AppleScript exits the statement, the application is informed that the transaction
is over, and the error continues through subsequent statements until it
is handled.
With Transaction 7
With Transaction statements cause AppleScript to associate a single transaction
ID with any events it sends to a target application as a result of executing
commands in the body of the With Transaction statement.
SYNTAX
with transaction [ session ]
[ statement ]...
end [ transaction ]
where
session is an object that specifies a specific session.
statement is any AppleScript statement.