Following the example of the Quake3 script, I set it up to cd to:
/System/Library/CoreServices/Classic Startup.app/Contents/Resources/
and had it launch "TruBlueEnvironment". The cool thing about doing it this way is that it launches quietly in the background, with no progress bar or bouncing icon. This seems to make launching Classic faster.
I also wanted to set up the script to "renice" Classic to speed it up (I use it mostly just for "Baldur's Gate" ;). I at first tried to only use the new "do shell script" feature of AppleScript, but ran into a problem where it would hang the script until after Classic/TruBlue quit, even when I sent it to the background with '&'. After much experimentation and tweaking, I found the solution.
Read the rest of the article for the script (as well as a generic app launcher and renicer script)
Silent launch and renice Classic script:
property appPath : "/System/Library/CoreServices/Classic Startup.app/Contents/Resources/"[Depending on the performance of your Mac, you may need to modify the delays]
property appName : "TruBlueEnvironment"
tell application "Terminal"
do script with command "cd '" & appPath & "';./" & appName & "&;exit"
delay 6
quit
end tell
delay 1
do shell script "sudo renice -12 -p `ps -ax | awk '{ if¬
( /" & appName & "/ && $0 !~ /awk/ ) { print $1;exit } }'`"
That final line also shows the fruits of my experiments at finding the best way to guarantee that you're getting the process-id you want from "ps" (and until OS X comes with "pidof", it'll have to do ;).
For other applications, I prefer to use a different script that I also came up with. It's simpler and doesn't require the launching of Terminal. Here's what I use for Quake:
property appName : "Quake3"I've found the best way to launch these is to use Apple's Script Menu. Not only is it a very convenient place to keep and launch such scripts, but you don't have to worry about keeping a seperate run-only version.
tell application appName
run
end tell
delay 1
do shell script "sudo renice -15 -p `ps -ax | awk '{ if¬
( /" & appName & "/ && $0 !~ /awk/ ) { print $1 } }'`"

