Scripting Additions Guide

CHAPTER 1
Introduction to Scripting Additions
Sending Scripting Addition Commands
3
Scriptable Text Editor becomes the frontmost application (that is, its menus
become visible and its windows become the frontmost windows on the screen)
and passes the command to the scripting addition’s handler for the Display
Dialog command, which displays the dialog box.
tell application "Scriptable Text Editor"
display dialog "What’s your name?" default answer ""
end tell
In the next example, the Display Dialog command is not enclosed in a Tell
statement, nor does it have a direct parameter, so its target is the Script Editor
(or whatever application runs the script). When you run the script, the Script
Editor passes the command to the scripting addition’s handler for the Display
Dialog command, which displays the dialog box in the Script Editor’s layer
(that is, in front of any other Script Editor windows that may be open) while
the Script Editor is still the active application.
set theCount to number of words in front document of
¬
app "Scriptable Text Editor"
if theCount > 500 then
display dialog "You have exceeded your word limit."
end
You can send scripting addition commands to a target on any remote computer
whose Scripting Additions folder contains the appropriate scripting addition
file. This is true no matter which scripting additions are available to the
computer from which you are sending the command. For example, you can
send the Display Dialog command to any application on a remote computer
whose Scripting Additions folder contains the Display Dialog scripting
addition, even if the Scripting Additions folder on your computer doesn’t
contain that file.
Each scripting addition that contains command handlers has its own
dictionary, which lists the reserved words—including the command
names, parameter labels, and in some cases object names—used to invoke
the commands supported by the scripting addition. If a scripting addition
dictionary includes words that are also part of an application dictionary,
then you cannot use those words within Tell statements to that application.