Chapter 20. Scripting Additions

A scripting addition is a compiled code fragment, typically written in a language such as C, that extends the AppleScript language. A scripting addition can’t be targeted, and doesn’t need to be; the commands that it implements are present as if built into AppleScript itself (see Section 19.1).

The scripting addition file StandardAdditions.osax is present on every machine. Therefore, even though AppleScript technically remains a “little language” with no ability to read files, put up dialogs, and so forth, such functionality is in fact essentially part of AppleScript (see Section 4.7).

This chapter provides some technical discussion of scripting additions generally, and then surveys the contents of the StandardAdditions osax. I’m not going to teach you how to write a scripting addition. If you’re interested, see the vitally important Tech Note on the subject from Apple, http://developer.apple.com/technotes/tn/tn1164.html. See also http://www.mactech.com/articles/mactech/Vol.10/10.01/ExtendApplescript/ and http://www.latenightsw.com/technotes/ScriptingAddition/.

Pros and Cons of Scripting Additions

In certain ways, scripting additions are clearly a Bad Thing, and Apple actively discourages them. As Apple puts it, “There are severe limitations to what you can do in the context of a scripting addition, and the system costs of managing large numbers of scripting additions are high.” The main limitation is that a scripting addition cannot define any classes. ...

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.