Language Guide
CHAPTER 4
Commands
Types of Commands 75
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
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 sup-
ported 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.
For example, the Offset command provided by the String Commands scripting
addition reports the offset, in characters, of a string within another string.
Offset is also a property of several Scriptable Text Editor objects and is thus a
word in the Scriptable Text Editor dictionary. Therefore, you cannot use Offset
as a scripting addition command within Tell statements to the Scriptable Text
Editor. If you do, you’ll get a syntax error, because AppleScript treats the word
Offset as a property of a text object.
tell front document of application "Scriptable Text Editor"
offset of "great" in "To be great"
end tell
--result: syntax error
If you specify a script object as the target of a scripting addition command, the
script object either handles the command itself (potentially modifying it) or
passes the command to the default target application. For more information
about scripting additions and script objects, see “Using Continue Statements to
Pass Commands to Applications,” which begins on page 280.
For information about the scripting additions available for AppleScript English
and definitions of the commands they provide, see the AppleScript Scripting
Additions Guide.