Language Guide

CHAPTER 4
Commands
Using Command Denitions 79
parameters, the description in the “Parameters” section specifies a default
value that is used if you don’t include the parameter.
For more information about direct parameters, see “Application Commands”
on page 72. For more information about using parameters, see “Using
Parameters” on page 80.
Result 4
Many, but not all, commands return results. The result of a command is the
value generated when the command is executed. The “Result” section of a
command definition tells whether a result is returned, and if so, lists its class.
For example, the result of the Move command shown in Figure 4-1 is a
reference to the object that was moved.
For more information about results, see “Using Results” on page 82.
Examples 4
Each command definition includes one or more short examples demonstrating
how to use the command. The example in Figure 4-1 shows how to use the
Move command to move a word in the Scriptable Text Editor.
Errors 4
Commands can return error messages as well as results. An error message is a
message that is returned by an application, AppleScript, or the operating
system if an error occurs during the handling of a command. The “Errors”
section of a command definition, if present, lists errors that are likely to be
returned by a particular command. This information can help you decide if you
need to write error handlers to respond to the error messages that are returned.
Error handlers are described in Chapter 8, “Handlers.”
Some “errors” are not the result of abnormal conditions but are the normal way
you get information about what happened during command execution. For
example, you use the Choose File command to ask the user to choose a file.
When AppleScript executes this command, it displays a dialog box similar to
the one you get when you choose Open from the File menu. If the user presses