Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 4. Basic Concepts > Scripting Addition - Pg. 91

applet does not prevent you from continuing to edit and develop the script--nor does it hide the script from prying eyes (for that, you must also save the script as run-only). An applet contains a very small amount of genuine executable code--just enough to qualify it as a true application. This code, called the bootstrap code , is what initially runs when the applet is launched. It summons a scripting component called the Script Application Component. This component does the rest, handing the applet's compiled script over to the AppleScript scripting component for execution, and taking care of such things as putting up the applet's description window if there is one. The applet also contains the other resources necessary to make it a scriptable application. In earlier versions of the Mac OS 9 Script Editor there was an option to save as a Mac OS X applet, but in my experiments a Mac OS X applet saved in this way wouldn't open successfully in Mac OS X. The most recent version of the Mac OS 9 Script Editor abolishes this distinction, and offers to save simply as an "application"; the resulting applet runs under either Mac OS X or Mac OS 9. In earlier versions of the Mac OS X Script Editor (such as version 1.9), an applet could be set to "require Classic"; in this case the applet was saved as a Classic-only application and the Get Info option to toggle between opening in Mac OS X and opening in Classic was absent. An applet (but not an applet bundle) saved using the current Script Editor in Mac OS X can be launched in a previous system. For further details about how to make and write applets and droplets, as well as to learn how to use AppleScript Studio to write more sophisticated applications with a user interface, see Chapter 24. Scripting Addition 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 com- munication with a scriptable application. The difference, from the AppleScript pro- grammer's point of view, is a linguistic one: the scripting addition's vocabulary is avail- able 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 ad- dition 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 imple- mented in this lower-level language (possibly by calling into the Macintosh Toolbox) but is otherwise missing from AppleScript itself. Scripting Addition | 91