Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

An AppleScript that checks on Classic Classic
At present, the only way to tell if Classic is running or not is to open the System Prefs panel and look at the Classic pane, or double-click a Classic app and see if Classic launches. In response to a question on the X4U mailing list, David Nelson created a very slick little AppleScript that answers the question in a much nicer way. With his permission, I'm reposting the script here.

Open ScriptEditor and paste in the following lines:
-- Start Script
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
say "Classic is running."
else
say "Classic is not running."
end if
end tell
-- End Script
You could skip the commented lines, obviously. After creating the script, select "Save as Run-Only" from the File manu and change the format to "Application" and save the script.

Once saved, just double-click the script and your Mac will audibly tell you whether Classic is running or not. Place the script in the dock or a Finder toolbar for fast access.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,683 views]  

An AppleScript that checks on Classic | 18 comments | Create New Account
Click here to return to the 'An AppleScript that checks on Classic' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
The Classic Environment
Authored by: RichB on Sat, Dec 8 2001 at 1:26PM PST
There's also a nice freeware script called The Classic Environment.

[ Reply to This | # ]
Modify script to quit Classic
Authored by: ashill on Sat, Dec 8 2001 at 2:34PM PST
If you add the line
tell application "Classic Support" to quit
inside the if statement, this script will cleanly quit Classic (i.e. it will do a shutdown, allowing you to save changes in running Classic applications). Finally, a way to quit Classic without going to System Prefs! -Alex Hill

[ Reply to This | # ]
Modify script to quit Classic
Authored by: rusto on Sat, Dec 8 2001 at 5:07PM PST
Why not let the user decide whether to quit Classic upon discovering that it is running:
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
activate
say "Classic is running."
display dialog "Want to quit Classic?" buttons {"No", "Yes"} default button "No"
set the user_choice to the button returned of the result
if the user_choice is "Yes" then
tell application "Classic Support" to quit
end if
else
say "Classic is not running."
end if
end tell
Unfortunately, the way AppleScript seems to work in OS X, you have to bring the finder to the front for that dialog box to appear.

[ Reply to This | # ]
Nice!
Authored by: RichB on Sat, Dec 8 2001 at 6:09PM PST
Better than "The Classic Environment" freeware script.

Use that 9 icon too for a nice effect!

[ Reply to This | # ]
Modify script to quit Classic
Authored by: babbage on Sat, Dec 8 2001 at 7:53PM PST
Better still, why not let the user decide either way? I don't really know Applescript very well, but it looks like you can do something like this:
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
activate
say "Classic is running."
display dialog "Want to quit Classic?" buttons {"No", "Yes"} default button "No"
set the user_choice to the button returned of the result
if the user_choice is "Yes" then
tell application "Classic Support" to quit
end if
else
activate
say "Classic is not running."
display dialog "Want to launch Classic?" buttons {"No", "Yes"} default button "No"
set the user_choice to the button returned of the result
if the user_choice is "Yes" then
tell application "Classic Support" to launch
end if
end if
end tell
Alternatively, you should be able to poll classic through the terminal:
[localhost Sat 7:22:21pm ~]% ps aux | grep Classic
chris 405 0.0 0.1 1112 100 std U+ 0:00.01 grep Classic
[localhost Sat 7:43:07pm ~]% # launch classic from system preferences
[localhost Sat 7:47:27pm ~]% ps ax | grep Classic
406 ?? S 0:32.51 /System/Library/CoreServices/Classic Startup.app/Contents/MacOS/Classic Startup -psn_0_1441793
407 ?? R 0:59.28 /System/Library/CoreServices/Classic Startup.app/Contents/Resources/TruBlueEnvironment
412 std R+ 0:00.01 grep Classic
[localhost Sat 7:47:56pm ~]%
i.e. bring up a list of all running processes & filter it down to just ones realted to Classic. If you have anything running, then Classic must be running. If the only hit you get is the grep command (which doesn't always show up) then Classic isn't running. I haven't tried to wrap this up in a pretty script that will bring Classic up or down, partly because I'm lazy (I just want to know if it might need launching or halting, and don't mind going elsewhere to do it if so, in this case), and partly because I'm not sure how to do it from the shell anyway. I think you can just open a classic application & trick it into opening, and it might be kosher to "sudo kill -9" any Classic processes you find (???), but I'm not sure how good either of these solutions are, and since the point here is just to ask, not to do anything about the answer, then it's sufficient for me.

[ Reply to This | # ]
Modify script to quit Classic
Authored by: rusto on Sat, Dec 8 2001 at 10:01PM PST
Gah, you beat me to it! I blame my wife, "Hurry up, dinner's ready!" Geez. I've also modified the script to offer the other option, grab it ready to go, here: ClassicCheck

[ Reply to This | # ]
new non auditable spin on this latest variant
Authored by: meancode on Sat, Dec 8 2001 at 10:26PM PST
thanks a lot. i put the script in the Dock and also in the Script Menu. it works 99% of the time. but occasionaly i have to force quit it. then re-run the script again and it works every time. also this latest version of the script will bring the finder to the foreground so you do not have to click the finder. dont know why as there is no difference to the tell command. i edited it a tad, took out the "say" here is my edited version.
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
activate
display dialog "Classic is running, want to quit it?" buttons {"No", "Yes"} default button "No"
set the user_choice to the button returned of the result
if the user_choice is "Yes" then
tell application "Classic Support" to quit
end if
else
activate
display dialog "Classic is not running want to launch it?" buttons {"No", "Yes"} default button "No"
set the user_choice to the button returned of the result
if the user_choice is "Yes" then
tell application "Classic Support" to launch
end if
end if
end tell
it works great! thanks to all that have contributed to making this script even better and more functional than the one rob originally posted. Ken Edwards ken@meancode.com

[ Reply to This | # ]
just added restart
Authored by: stift on Sun, Dec 9 2001 at 7:35AM PST
just modified the script with a restart option, if someone needs that just grab it here

[ Reply to This | # ]
just added restart
Authored by: RichB on Sun, Dec 9 2001 at 5:32PM PST
Saved As Run Only means I can't edit your choices. An application with out startup screen is enough.

[ Reply to This | # ]
just added restart
Authored by: ben on Sun, Mar 10 2002 at 11:13PM PST
Great!Thanks Ben

[ Reply to This | # ]
ToggleClassic
Authored by: echo on Sat, Dec 8 2001 at 6:43PM PST
I use a script by the author of "TransparentDock", called "ToggleClassic". From the author's description: "If Classic is active when the script is launched, the Classic environment will be shut down. Likewise, if Classic is inactive when the script is launched, the Classic environment will be started up. There is always a five second delay with a cancel option if you change your mind." I have this in the dock, with the classic icon pasted on it, as in the last tip. What I'd really like is to have the icon in the dock indicate whether Classic is running or not. You can find this authors script's at: http://homepage.mac.com/kfkel/

[ Reply to This | # ]
My variation on the same script
Authored by: efoivx on Sat, Dec 8 2001 at 10:06PM PST
This is my script that I use. I cleaned it up and added variables to turn features on and off. Copy and paste it into a script, set the variables at the top of the script and that's it.
--Set user definable Configs
set displayDialogs to 1 --change the 0 to just use Speech
set UseSpeech to 0 -- chnge to 1 to have Speech tell you IF Classic is running or not
set i to 8 -- seconds to wait before dismissing the dialog automatically 0 is off
-- End user definable configs

-------------------------- Begin Script
if displayDialogs = 0 then
set UseSpeech to 1
end if
tell application "Finder"
if (name of (every application process)) contains "Classic Support" then
activate
if UseSpeech = 1 then
say "Classic is running."
end if
if displayDialogs = 1 then
beep
display dialog "
Classic is running. Shutdown Classic?" buttons ¬
{"Yes", "No"} default button "No" with icon caution giving up after i
set the btnRetrnd to the button returned of the result

if the btnRetrnd is "Yes" then
tell application "Classic Support" to quit
end if
end if
else --classic is not running
activate
if UseSpeech = 1 then
say "Classic is not running."
end if
if displayDialogs = 1 then
beep
display dialog "Classic is not running. Startup Classic?" buttons ¬
{"Yes", "No"} default button "No" with icon caution giving up after i
set the btnRetrnd to the button returned of the result
if the btnRetrnd is "Yes" then
tell application "Classic Startup" to activate
end if
end if
end if
end tell


[ Reply to This | # ]
easier still...
Authored by: lugal on Sat, Dec 8 2001 at 11:06PM PST
At present, the only way to tell if Classic is running or not is to open the System Prefs panel and look at the Classic pane, or double-click a Classic app and see if Classic launches.
Or, you could just hit Command-Option-Escape--it's faster and easier than either of these two methods.

[ Reply to This | # ]
Cmd - alt - esc
Authored by: didde on Sun, Dec 9 2001 at 4:54AM PST
cmd - alt - esc is the fastest.

if the classic environment is present in the list you know it's up and running..

(dd.)

[ Reply to This | # ]
CLI Options - ps or top
Authored by: autohag on Sun, Dec 9 2001 at 11:19AM PST
If you always keep a Terminal window open like me, you can just use either 'ps x | grep Tru' or 'top | grep Tru'. Or just create an alias of either.

[ Reply to This | # ]
A dock icon to show status and toggle state of Classic
Authored by: efoivx on Mon, Dec 10 2001 at 2:50AM PST
Here's a quick utility I whipped up for you. Put the app on the dock and start it it's not a Dockling (sorry don't know how to make one) The Dock icon will change to reflect the state of Classic Running or Not Running a Glowing Green 9 is running grey dimmed 9 is not running the Dock Icon also has a sub menu to startup or shurdown classic Download it and give it a try http://jupitermultimedia.com/Classiccheck.sit 703k let me know what you think of it Cheers Eddie

[ Reply to This | # ]
A dock icon to show status and toggle state of Classic
Authored by: efoivx on Tue, Dec 25 2001 at 5:44PM PST
updated the new link to download the above utility is http://xgadgets.com

[ Reply to This | # ]
There's an easy way already in OSX
Authored by: jdpate on Fri, Dec 28 2001 at 10:49AM PST
Want to see it in the dock. Just drag the icon from Classic Starup to the dock. You'll find it @ System/Library/CoreServices/Classic Startup. Now it appears on your dock as it did in OSX beta. When Classic is running, you get your little visual aid triangle.

[ Reply to This | # ]