Language Guide

CHAPTER 7
Control Statements
Tell Statements 185
You can use a simple statement only when you’re controlling the execution of a
single statement (such as return x in the previous example).
Tell Statements 7
Tell statements specify the default target, the object to which commands are
sent if they do not include a direct parameter. For example, in the following
Tell statement, the Close command does not include a direct parameter.
tell front window
close
end tell
As a result, the Close command is sent to the front window, the default target
specified in the Tell statement.
When AppleScript encounters a partial reference (a reference that does not
specify every container of an object), it uses the default target to complete it.
For example, in the following Tell statement, the reference word 3 does not
specify all of the containers of the word object, so AppleScript completes it with
the default target.
tell front document of application "Scriptable Text Editor"
delete word 3
end tell
The result is that the Delete command is sent to the third word of the front
document of the Scriptable Text Editor.
A Tell statement also indicates which dictionary AppleScript should use to
interpret words contained in the statement. For example, the previous Tell
statement tells AppleScript to use the Scriptable Text Editor dictionary, which
contains the definitions for the Delete command and the word object. If the
Tell statement had not specified the application, AppleScript would not have
understood the Delete command.
If you refer to another application within a Tell statement to an application,
AppleScript uses the dictionaries of both applications to interpret the words
in the statement. For example, in response to the following Tell statement,