The FooDoo Lounge

Scripting Additions (osaxen)

Information for kiteWare users

Some of my scripts require the use of Scripting Additions that are not part of a standard installation of AppleScript. These are mostly optional, but a number of projects require the Dialog Director osax and will not function without it.

A Scripting Addition (or osax - for Open Scripting Archtiecture eXtension) adds functionality to AppleScript by extending the language and offering either new functionality or better (faster &/or more compact) ways for scripters to do existing things.

For reasons of download size and legality, I do not bundle any osaxen with my downloadable packages. I realise this is inconvenient, but it seems to be the best of a bad bunch of options. Most of the 3rd party additions, and there are many of them, are free, or free for non-commercial use. If a script requires a particular osax, that file must be installed on your computer.

Scripting Additions are loaded by the AppleScript extension whenever a script or script application is run (not at startup, like system extensions) and do not appear to cause system slowdowns or instability. In other words, they seem to be mostly harmless.

Installing Scripting Additions is reasonably painless. OS8 or 9 will auto-route them to the Scripting Additions folder if you drag the osax onto your closed System Folder. Alternatively, just drag it to the SA folder manually. This folder is in the Extensions folder under System 7, or in the System Folder itself under OS8.x and 9.x.

Under OS X, Apple's own osaxen are in "/System/Library/ScriptingAdditions/", globally available osaxen in "/Library/ScriptingAdditions/" and user specific ones are in "~/Library/ScriptingAdditions/".

Information for Scripters

Apart from my Dialog Director projects, I try to write code that uses particular osaxen if they're installed, but that will operate anyway - either at reduced speed or with less functionality - if they're not. This, at its simplest, is done like so:

try
    -- call your osax
on error
    -- call your vanilla code
end try

This construct does slow the vanilla code execution - because AS has to handle the error - but is a straightforward way to add an extra level of robustness to scripts that may have to operate in different environments.

Apple ships a number of osaxen with AppleScript and these can be found in your Scripting Additions folder(s). Just drop the file(s) onto Script Editor to see their dictionaries.

Scripting Additions used in kiteWare projects

I use one or more of these handy little tools in many of my scripts. Click on the link for further information:

 

The FooDoo Lounge is Copyright © Richard Morton 2002-2005

|| url: http://www.foodoo.sunreal.com.au/osax/osaxen.html
|| created: 4-Aug-03, 10:29 PM; updated: 4-Aug-03, 11:56 AM
|| size: 11600 bytes