AppleScript_ The Definitive Guide - Matt Neuburg [39]
When you save your script as an application, the script editor application looks to see whether it has an open handler. If it does, the application becomes a droplet . A droplet is just like an applet, except that it has a different creator type (the creator type for an applet is 'aplt', while for a droplet it's 'dplt') and a slightly different icon; functionally, the difference is that a droplet does something when file or folder icons are dropped onto its icon in the Finder. Typically, a droplet responds to the dropped items by processing them in some way (for an example, see "Calculation and Repetition" in Chapter 1). A droplet can also function like an applet: as a droplet, it does something when items are dropped onto its icon, while as an applet, it does something when it is launched from the Finder.
An applet's script remains editable unless you save it as run-only . Unlike a compiled script file, you can't edit an applet's script by opening the applet from the Finder, because that launches the applet. Instead, you open it from within a script editor application, using File → Open, or by dropping the applet's icon on the script editor application's icon in the Finder. A running applet may also display some graphical interface offering a chance to edit its script.
An applet (or droplet) may alternatively be saved in bundle format; it is then an applet bundle . (Apple's Script Editor calls this format "application bundle.") This format is parallel to a bundle script; it has the same advantages (the bundle can contain other resources) and the same compatibility limitations (it cannot be used on a system earlier than Panther, Mac OS X 10.3). It also has an additional advantage of great importance: an applet bundle can contain and use a scripting addition , thus solving a longstanding limitation of scripting additions; this advantage is shared with AppleScript Studio applications, which are, after all, also a kind of bundle. (See "Scripting Addition" in this chapter, and "Loading Scripting Additions" in Chapter 21. An example of an applet bundle in action appears in "Persistence" in Chapter 27.)
An applet (not an applet bundle) created by Apple's Script Editor can be both executed and edited on any earlier system. Amusingly, this makes an applet a much more portable format than a compiled script file. (An option that was present in earlier versions of the Mac OS X Script Editor, such as version 1.9, to make an applet "require Classic," was confusing and unnecessary and is now mercifully gone. For the same effect, simply use the "Open in the Classic environment" checkbox in an applet's Finder Info window.)
Tip
But what about compatibility in the other direction? An applet created in an sufficiently early system obviously can run only in Classic. In (Classic) Script Editor 1.4.3, by which time Mac OS X was already on the rise, there is an option to save as a Mac OS X applet, but in fact the resulting applet won't open in Mac OS X. Finally, in (Classic) Script Editor 1.8.3, this distinction was abolished; an applet saved with this version of Script Editor runs in Classic or in Mac OS X.
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 AppleScript-based applications with a user interface, see Chapter 27.
Scripting Addition
AppleScript is a little language, and at a very early stage it was felt to be a bit too little. An architecture was therefore devised whereby Apple, as well as third-party developers, could extend the language by means of scripting additions. A scripting addition is a code library, typically written in a compiled lower-level language such as C, whose purpose is usually to endow AppleScript with 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. On Mac OS 9 and before, a scripting addition is a resource file of type 'osax'; on Mac OS X it can also