Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A couple of Classic management scripts Classic
From a contributor who wishes to remain anonymous, here are two scripts for dealing with Classic. The first script, "Classic Permissions", pops-up a dialog box that enables or disables future Classic launches. This can be handy if you're tired of Classic launching when you double-click an icon that is associated with Classic.

The second script, "Classic Single Serving", enables Classic, launches it, waits for it to finish launching, and then disables future launches.

Read the rest of the article for the scripts...

Classic Permissions

This script pops up a dialog box allowing you to Enable or Disable future Classic launches.
  • Enter your admin password on the first line.
  • Save the script as an application.
  • Since your admin password in is the script, you may want to save as Run-Only.
set ps to "enter your password here"

set pth to "'/System/Library/CoreServices/Classic Startup.app'"
do shell script "ls -l '/system/library/coreservices/classic startup.app'"
if result = "ls: Contents: Permission denied" then
display dialog "Classic is Disabled." with icon stop
buttons ["ENABLE", "Cancel"] default button 2
do shell script "chmod 0754 " & pth password ps
with administrator privileges
else
display dialog "Classic is ENABLED." with icon note
buttons ["Disable", "Cancel"] default button 2
do shell script "chmod 0644 " & pth password ps
with administrator privileges
end if
Classic Single Serving

This script Enables Classic, launches Classic, waits until Classic has finished launching, and then Disables future Classic launches.
  • Enter your admin password on the third line.
  • Save the script as an application. Check the Stay Open checkbox while saving.
  • Since your admin password in is the script, you may want to save as Run-Only.
global ps, pth
on run
set ps to "enter your password here"
set pth to "'/System/Library/CoreServices/Classic Startup.app'"
do shell script "chmod 0754 " & pth password ps with
administrator privileges
tell application "Classic Startup"
activate
end tell
idle
end run

on idle
set xx to "Classic Startup"
tell application "Finder"
set yy to name of process xx
end tell
try
if yy = xx then set p to 1
set zz to 1 as boolean
on error
set zz to 0 as boolean
end try
if not zz then
do shell script "chmod 0644 " & pth password ps with
administrator privileges
quit me
end if
return 5
end idle
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,077 views]  

A couple of Classic management scripts | 7 comments | Create New Account
Click here to return to the 'A couple of Classic management scripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
bad form
Authored by: mervTormel on Feb 02, '02 03:12:18AM

it is considered bad form to have any password embedded anywhere.

find another solution for authenticating the script. thare are some out there.

don't write passwords down anywhere.

passwords should be of the mind, only accessible by sodium pentathol and the promise of something nice in return ;]



[ Reply to This | # ]
bad form - but...
Authored by: Maran on Feb 02, '02 10:37:48AM

Agreed. But, the idea is excellent, and the rest of the implementation seems just right --

How hard would it be to add some code at the beginning that prompts the user for the admin password to run these scripts instead of having to embed it? I don't know AppleScript and I guess I'm inclined to ask if anyone who does is willing to remedy these great ideas to make them secure - before I go out and try to learn to do it myself.

Kudos to the anonymous originator -- who's willing to improve it?



[ Reply to This | # ]
Found a way to secure these scripts
Authored by: Maran on Feb 02, '02 01:48:46PM

If you don't assign or pass along a password at all in these scripts, the OS (10.1.2 anyway) automatically prompts you with a standard password dialogue box to get administrative permission to complete the requested actions.

Here is the modified toggle script:

set pth to "'/System/Library/CoreServices/Classic Startup.app'"
do shell script "ls -l '/system/library/coreservices/classic startup.app'"
if result = "ls: Contents: Permission denied" then
display dialog "Classic is Disabled." with icon stop
buttons ["ENABLE", "Cancel"] default button 2
do shell script "chmod 0754 " & pth
with administrator privileges
else
display dialog "Classic is ENABLED." with icon note
buttons ["Disable", "Cancel"] default button 2
do shell script "chmod 0644 " & pth
with administrator privileges
end if


Here is the modified open classic once script:

global pth
on run
set ps to "enter your password here"
set pth to "'/System/Library/CoreServices/Classic Startup.app'"
do shell script "chmod 0754 " & pth with administrator privileges

tell application "Classic Startup"
activate
end tell
idle
end run
on idle
set xx to "Classic Startup"
tell application "Finder"
set yy to name of process xx
end tell
try
if yy = xx then set p to 1
set zz to 1 as boolean
on error
set zz to 0 as boolean
end try
if not zz then
do shell script "chmod 0644 " & pth with administrator privileges

quit me
end if
return 5
end idle


I'm definitely going to use these. Hope someone else feels more comfortable using them now too.

Maran



[ Reply to This | # ]
Run Only Scripts
Authored by: petey on Feb 03, '02 02:40:52PM

As far as I know,

Run Only Scripts are secure. You can embed a password in a Run Only Script, and should the script fall into the wrong hands, the password will remain a mystery.



[ Reply to This | # ]
Run Only Scripts -- NOT SECURE
Authored by: wealthychef on Feb 04, '02 10:24:13PM

Sorry to drift a bit off topic, but this needs correction. Just because you can't read it with a text editor, doesn't mean it's secure. Compiled code from publicly known source isn't secure, because people can just look in the binary file for the password. It's still stored as bytes, and bytes are readable with very little effort. All a hacker has to do is compile the code himself with his own word in place of password, and see where in the code his word ends up. Your password will appear in the same place in your compiled version. In the case of this little script, right near the top, in fact.



[ Reply to This | # ]
Run Only Scripts -- NOT SECURE
Authored by: petey on Feb 04, '02 10:46:36PM

not at all off topic...

so let me see if i understand:

if a hacker knows the exact text of a compiled script, they can find the password?

what would the actual steps be? what app would they open the script with?

and if the compiled script is altered from the public source, then it would be difficult/impossible to find the password?



[ Reply to This | # ]
How do I save as an application
Authored by: uochris on May 22, '02 01:44:48PM

Forgive the newbie question but how do I go about saving this script as an application so I can run it? Affter sing carbon copy cloner I'm unable to use classic as a non admin user because I have insufficient permissions to run classic from /System Folder and I'm hoping this script can fix things for me.



[ Reply to This | # ]