Language Guide
CHAPTER 4
Commands
72 Types of Commands
The sections that follow describe the different types of commands and
their targets.
Application Commands 4
Application commands are commands that cause actions in scriptable
applications. The target of an application command is an application object
or a script object. Different application objects respond to different commands.
To determine which commands a particular object can respond to, see the
definitions provided by the application’s documentation. (For example, each
object definition in Appendix B, “Scriptable Text Editor Dictionary,” of this
book includes a list of commands that can act on that object.)
There are two ways to specify an object as the target of a command: in the
direct parameter of the command or in a Tell statement that contains
the command.
The direct parameter is a value, usually a reference, that appears immediately
after a command and specifies the target of the command. Not all commands
can have a direct parameter. If a command can have a direct parameter, the
command’s definition says so.
For example, in the following statement, the reference word 1 of front
document of app "Scriptable Text Editor" is the direct parameter
of the Delete command:
delete word 1 of front document of app "Scriptable Text Editor"
A Tell statement is a statement that specifies a default target for all commands
contained within it. If a command is contained within a Tell statement, the
direct parameter is optional. If you leave out the direct parameter, AppleScript
uses the default target specified in the Tell statement. For example, the Delete
command in the following Tell statement has the same effect as the Delete
command in the previous example:
tell word 1 of front document of app "Scriptable Text Editor"
delete
end tell