Language Guide
CHAPTER 4
Commands
82 Using Results
two different applications to edit a graphic, the data value returned by one
Edit Graphic command can be sent as the direct parameter of another Edit
Graphic command.
If an application returns values of class Data, its documentation should say so.
Using Results 4
The result of a command is the value generated when the command is executed.
You can display the result of a command in the Script Editor. For example, if
you run the following script,
tell front document of application "Scriptable Text Editor"
move word 1 to end of paragraph 1
end tell
and then choose Show Result from the Controls menu in the Script Editor,
you’ll see a value such as
word 32 of front document of application "Scriptable Text Editor"
You can use a command that returns a result as a value. For example, the Count
command in the following statement returns a value: the number of words in
the third paragraph.
count words in paragraph 3
You can use this statement anywhere a value is required by enclosing the
statement in parentheses. For example, the following statement sets the value
of numWords to the value returned by the Count command.
set numWords to (count words in paragraph 3)
In addition to displaying the result of a command in the result window,
AppleScript puts the result into a predefined variable called result. The value
remains there until the next command is executed. If the next command does
not return a result, the value of result is undefined. The following two