Scripting Additions Guide

CHAPTER 1
Introduction to Scripting Additions
2
Sending Scripting Addition Commands
Each scripting addition file contains one or more command handlers. If a
scripting addition file is located in the Scripting Additions folder (in the
Extensions folder of the System Folder), the command handlers it provides are
available for use by any script whose target is an application on that computer.
Some scripting additions also define object classes for records returned by their
commands. However, scripting addition commands do not normally act on
objects defined by individual applications.
The scripting addition commands Activate, Log, Start Log, and Stop Log are
part of the AppleScript extension and do not have separate files in the Scripting
Additions folder. With the exception of these commands, AppleScript
recognizes scripting addition commands only if the corresponding scripting
addition files are located in the Scripting Additions folder. If after installing
AppleScript you receive additional scripting additions from Apple or another
vendor, you must copy them into the Scripting Additions folder before you can
use their commands in scripts.
If you use a scripting addition command in a script and get an error message
stating that the command is undefined, check to make sure the corresponding
scripting addition is installed in the Scripting Additions folder.
Sending Scripting Addition Commands 1
Like the target of an application command, the target of a scripting addition
command is always an application object or a script object. If the script
doesn’t explicitly specify the target with a Tell statement, AppleScript sends
the command to the default target application, which is usually the application
running the script (for example, the Script Editor).
A scripting addition command performs its action only after the command has
been received by a target application. Unlike application commands, scripting
addition commands always work the same way regardless of the application to
which they are sent.
For example, the scripting addition command Display Dialog displays a dialog
box that can include text, one or more buttons, an icon, and a field in which the
user can type text. In the script that follows, the target of the Display Dialog
command is the Scriptable Text Editor application. When the script runs, the