Language Guide
CHAPTER 2
Overview of AppleScript
Dictionaries 19
AppleScript does not have a single fixed set of definitions for use with all
applications. Instead, when you write scripts in AppleScript, you use both
definitions provided by AppleScript and definitions provided by individual
applications to suit their capabilities.
Dictionaries tell you which objects are available in a particular application and
which commands you can use to control them. Typically, the documentation
for a scriptable application includes a complete list of the words in its
dictionary. For example, Appendix B of this book contains a complete list of the
words in the Scriptable Text Editor dictionary. In addition, if you are using the
Script Editor, you can view the list of commands and objects for a particular
application in a Dictionary window. For more information, see Getting Started
With AppleScript.
To use the words from an application’s dictionary in a script, you must indicate
which application you want to manipulate. You can do this with a Tell
statement that lists the name of the application:
tell application "Scriptable Text Editor"
print front window
close front window
end tell
AppleScript reads the words in the application’s dictionary at the beginning
of the Tell statement and uses them to interpret the statements in the Tell
statement. For example, AppleScript uses the words in the Scriptable Text
Editor dictionary to interpret the Print and Close commands in the Tell
statement shown in the example.
Another way to use an application’s dictionary is to specify the application
name completely in a simple statement:
print front window of application "Scriptable Text Editor"
In this case, AppleScript uses the words in the Scriptable Text Editor dictionary
to interpret the words in this statement only.
When you use a Tell statement or specify an application name completely in
a statement, the AppleScript extension gets the dictionary resource for the
application and reads its dictionary of commands, objects, and other words.
Every scriptable application has a dictionary resource that defines the
commands, objects, and other words script writers can use in scripts to control