Classic Scripting Additions

There is a difference between a scripting addition intended to be used with Mac OS 9 or before and a scripting addition intended to be used with Mac OS X. A Mac OS X-type osax will not work on Mac OS 9. A Mac OS 9-type osax will work on Mac OS X only if it has been Carbonized, meaning that internally its Toolbox calls have been linked against CarbonLib. In general, any particular osax file will probably be intended for one system or the other, not both. You may not be able to tell just by looking; if the Show Package Contents menu item appears in the Finder’s contextual menu for an osax, it is certainly for Mac OS X, but otherwise you may need to consult the osax’s documentation.

Classic implements AppleScript separately from Mac OS X, but the two are compatible and Apple events travel back and forth across the “system barrier.” The Classic system contains osaxen, which are implemented by the Classic version of AppleScript. This raises the question of how the presence of osaxen in Classic affects scripts running under Mac OS X.

The answer seems to be that when you run a script under Mac OS X, in code that targets a Classic application, any terminology that is resolved as belonging to a scripting addition is handled by a Classic scripting addition if possible. You can see this with a term like display dialog, because the dialogs put up by the Mac OS X and Classic versions of this command differ in appearance. So, for example:

tell application "Panorama" ...

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.