A scripting addition is a code library, loaded by the AppleScript scripting component instance, that implements vocabulary extending the AppleScript language. Behind the scenes, communication with a scripting addition uses Apple events, just as does communication with a scriptable application. The difference, from the AppleScript programmer’s point of view, is a linguistic one: the scripting addition’s vocabulary is available to scripts compiled and run on that machine with no need to target any particular application. In other words, the extended vocabulary implemented by a scripting addition appears to the programmer to be built into AppleScript itself.
Scripting additions are typically written in a compiled lower-level language such as C. Their purpose is usually to bring to AppleScript some functionality that can be implemented in this lower-level language (possibly by calling into the Macintosh Toolbox) but is otherwise missing from AppleScript itself.
addition on Mac OS 9 is a resource file of type
osax‘. On Mac OS X it can also be a bundle with
.osax. A scripting addition is often
referred to as an
osax (plural osaxen).
On Mac OS 9, osaxen live in the System Folder, in its Scripting
Additions subfolder. On Mac OS X the supplied osaxen live in
/System/Library/ScriptingAdditions; the user may
add osaxen to
/Library/ScriptingAdditions or to
~/Library/ScriptingAdditions, according to the
domain of their desired availability.
AppleScript is a little language, and at a very early stage it was
felt to be a bit too little; so certain sorely
missed features were added by Apple itself, implemented through
scripting additions present on every machine. This got more confusing
as more such “official” scripting
additions were added. In recent times the situation has been
simplified considerably by the incorporation of most of these
scripting additions into a single scripting addition called
(or, on Mac OS X,
Other developers are welcome to write scripting additions, and many have done so; there is a large body of freeware, shareware, and commercial scripting additions available. Typically the reason for writing a scripting addition rather than an application is simply that its extensions to the language are present universally without launching or targeting an application. On the other hand, this universal presence can be a problem, because it is possible for vocabulary terms implemented in different scripting additions to conflict with one another or with the vocabulary implemented by particular applications or even AppleScript itself. This point is taken up again in Chapter 19.