I wrote a script that checks for Classic mode when running OS X 10.1.3… if it’s running, there’s the option to close it, and if it’s not running, there’s the option to launch it.
The problem is that launching it works, but then hangs the script (or the script editor, if I run it from there). I have to force-quit to get rid of it. Classic mode comes up fine, however.
No amount of ignoring application responses, try, etc. scripting has changed this result. Can anyone offer an explanation and, I hope, a workaround?
Thanks. Script follows:
tell application "System Events"
set classicExists to get (process "Classic Support" exists)
end tell
if classicExists = true then
set changeStatus to display dialog "Classic is running." buttons {"Close It", "OK"} default button "OK"
set action to button returned of changeStatus
if action = "Close It" then
tell application "Classic Support"
quit
end tell
end if
else
set changeStatus to display dialog "Classic is not running." buttons {"Launch It", "OK"} default button "OK"
set action to button returned of changeStatus
if action = "Launch It" then
launch application "Classic Support"
end if
end if
I have the solution to your problem. I had the exact same difficulty when trying to script the “Classic Support” application. The trick is not to send apple events to the “Classic Support” application, but instead to invoke it from the unix shell. use the following line of code
do shell script "cd '/Library/System/CoreServices/Classic Startup.app/Contents/MacOS/; ./'Classic Startup';"
What I did to get it to work is to launch “Classic Startup” instead of “Classic Support.”
Nevertheless, you still want to quit “Classic Support.”
on reopen
tell application “System Events”
set originalApp to name of first process whose frontmost is true
get (process “Classic Support” exists)
end tell
tell application originalApp
if the result is true then
display dialog "Classic is running." buttons {"Cancel", "Quit Classic"} ¬
default button "Quit Classic" with icon 1
tell application "Classic Support" to quit
else
display dialog "Classic is NOT running." buttons {"Cancel", "Launch Classic"} ¬
default button "Launch Classic" with icon 1
tell application "Classic Startup" to launch
end if
end tell
end reopen
Saved it as a Stay Open applet, made it a login item, and put an alias to it in a convenient place.
Moreover, got it out of my Dock by using the freeware Drop Script Backgrounder 1.0:
http://www.sentman.com/backgrounder/index.php
.