I was hoping to write a script to toggle Classic on and off; that is, write a script that checks to see if Classic is running, and turns it off if it is, or turns it on if not. Unfortunately, I can’t seem to figure out how to script things in the System Preferences–is that even possible?
If the above is not possible, but the System Prefs is scriptable, can I at least write one that will turn Classic off?
try this for checking if classic running.
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
display dialog "Classic is running."
else
display dialog "Classic is not running."
end if
end tell
Also if you add this line:
tell application "Classic Support" to quit
in the if statement is will quit and you will be able to save your files from classic.
It works! Unfortunately, there is one error… The line “tell application “Classic Support” to quit” does not work–AppleScript prompts me to locate that application, which I cannot find. Otherwise, the AppleScript works fine… So, how do I stop Classic once it is running? Here is my code so far:
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
display dialog "Classic is running." buttons {"Okay"}
display dialog "Would you like to quit Classic?" buttons {"Yes", "No"} default button 1
set quit_classic to button returned of the result
if the quit_classic is "Yes" then
tell application "Classic Support" to quit
else
display dialog "Classic is still running." buttons {"Okay"}
end if
else
display dialog "Classic is not running." buttons {"Okay"}
display dialog "Would you like to start Classic?" buttons {"Yes", "No"} default button 1
set start_classic to button returned of the result
if the start_classic is "Yes" then
tell application "Classic Startup" to activate
else
display dialog "Classic will not be started." buttons {"Okay"}
end if
end if
end tell
When you first compile the script it does ask where to find the “Classic Support” application. It should not ask again where to find it.
Classic Support can be found at “Hard Disk:System Folder:Classic Support”
Your script did just fine for me.