Chapter 23. Scriptable Applications

AppleScript's chief purpose is to let you communicate with scriptable applications. How you target a scriptable application using AppleScript depends on whether the application is local (run on the same computer and by the same user as your script) or remote (run on a different machine, or on the same machine but by a different logged-in user). You might also like to know what scriptable applications are included with a default installation of Tiger. (On creation of scriptable applications using applets, AppleScript Studio, and Cocoa, see Chapter 27.)

This book won't teach you how to script any particular application (see "The Scope of This Book" in the 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 of scripting it. The application will in any case have a dictionary (see Chapter 20).

Targeting Scriptable Applications

To target a scriptable application is to aim Apple events at it, like arrows. The principal linguistic device for targeting an application in AppleScript is the tell block containing an application specifier. Such a tell block actually has two purposes: it determines the target, if no other target is specified within the block, and (at compile time) it also causes a dictionary to be loaded, which may be used in the resolution of terminology. If the target of the tell block is expressed ...

Get AppleScript: The Definitive Guide, 2nd Edition 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.