Chapter 21. Scriptable Applications
The chief virtue and purpose of AppleScript lies in its ability to communicate with scriptable applications by means of Apple events. This chapter summarizes the ways in which such communication is performed, and points out a few scriptable applications that might otherwise go unnoticed.
If you were hoping that this chapter would teach you all about how to script some particular application, I’m afraid you’re going to be disappointed (see The Scope of This Bookthe Preface). If the application comes with documentation or examples showing how to script it, start with that. For certain applications, there may be third-party books or web pages devoted to the topic. The application will in any case have a dictionary; see Chapter 19.
Targeting Scriptable Applications
To target a scriptable application is to aim Apple events at it, like arrows. This section catalogues the various ways to do it.
Tell and Of
The
primary
linguistic device for targeting an application in AppleScript is the
tell block containing an application specifier. This actually has two
purposes: it determines the target, if no other target is specified
within the block, and it also causes a dictionary to be loaded, which
may be used in the resolution of terminology. Instead of a tell
block, the of
operator (or its equivalents)
can be used to form a target; this does not affect resolution of
terminology.
(See Section 10.2 and Section 10.2.4; Section 12.3 and Section 12.4; Section ...
Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.