Classic osaxen in OS X - example please?


I’m pretty experienced in scripting for OS 9 and have scripted OS X for a few months. I’m currently using Script Debugger under Panther on a G5 and working on both new scripts and migrating some large scripts to OS X.

Though I’ve performed countless web searches, for some reason I simply can’t get my head around calling functions from OS9 osaxen. I know that there are always other ways to perform functions which I’ve used osaxen for, so please treat this as a simple, generic example:

Say I want to use “order list” from Akua Sweets. Normally I would have used this both at the root level of the script or within a “tell application” pair where I was getting data out of Quark, for instance…

set sorted_list to order list un_sorted list

Can someone tell me in plain terms
(a) where do I place the Classic scripting additions on an OS X machine with a Classic system folder
(b) how do I then call the routine?

much gratefulness in advance.



You can put the Classic OSAX in the location where OS9 expects to find them: System Folder: Scripting Additions. It might work with them placed elsewhere, but I’ve never tried it.

Here’s the syntax, using the RegEx Commands OSAX as an example. The stay open script is a Classic applet which ensures the classic environment is launched.

tell application “stay open script”
set sampleText to “Lots of extra spaces.”
–this path must be hard coded
using terms from application “Macintosh HD:System Folder:Scripting Additions:RegEx Commands”
–this line just uses any function of the OSAX as you would call it in OS9
set revisedText to REReplace sampleText pattern " +" with " " --replace multiple spaces with one
end using terms from
end tell

NOTE: This will not work if your classic System Folder is installed on a separate partition. And I haven’t tested this since an early version of Jaguar, I believe. The good news: It runs surprisingly quick.


Ray Robertson

Thanks Ray!

For what it’s worth to anyone who finds this in a similar search to mine, I made a script called “stay open script” containing the following:

on idle
return 300
end idle

saved it (from Script Debugger) as a Stay open script

then adjusted Ray’s sample script so the hard-coded path pointed at my copy of Regex Commands. and it worked just fine.

Next question for me is how to see the darn dictionaries of Classic additions - it seems I can open them as individual dictionarys simply by dragging them onto Script Debugger, but I liked having them all listed together.

Anyhow, thanks Ray, you’ve given me just the help I need