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

AppleScript to switch from OS 9 to OS X Classic
I've written an AppleScript to change my startup disk to OS X when I'm booted in 9:
tell application "Startup Disk"
set startup system folder alias to alias
end tell
tell application "Finder"
end tell
Of course, change "OSXDisk" to the name of your disk containing OS X, and watch as I've broken the "set startup" line into two rows for easier display on the page -- enter it as one long row.

Why not just press the Option key when starting up to choose OS's to boot into? Because I have my ADB Wacom tablet, Kensington 4-button mouse and keyboard attached to my G4 with an iMate. I sure wish I had a similar AppleScript to change startup disks and restart when in OS X...
  • Currently 2.50 / 5
  You rated: 4 / 5 (4 votes cast)

AppleScript to switch from OS 9 to OS X | 9 comments | Create New Account
Click here to return to the 'AppleScript to switch from OS 9 to OS X' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Boot Process for older computers...
Authored by: grotz on Apr 17, '01 11:32:45AM

...also, the boot process for older computers doesn't allow for pressing "option" at startup. Unfortunately, the only Macs that do allow are all of the newer AGP-flavored variety, but I could be wrong. All I know is that hitting option does not work on my B&W G3/450 at home or my iMac (rev. 3?) at work.

[ Reply to This | # ]
Quickly setting boot device on Mac OS X
Authored by: sabi on Apr 17, '01 10:42:54PM

There are a few Open Firmware variables that control booting. The ones I know get changed (which exact ones depend on your Mac model) are 'boot-device', 'boot-command', and 'boot-args'.

For example, when I change my G4 to boot from OS X, the boot-device is:

boot-device mac-io/ata-4@1f000/@0:13,\\\\:tbxi

Booting from OS 9, it is:

boot-device mac-io/ata-4@1f000/@0:9,\\\\:tbxi

The device names should be pretty self-explanatory. The "9" or "13" is a partition number, and the "\\\\:tbxi" tells OF to look for a file with type 'tbxi' (Open Firmware boot script) in the System Folder. On OS 9, this is the "Mac OS ROM" file; on OS X, it is /System/Library/CoreServices/BootX.

You can use the 'nvram' command to write OF variables to NVRAM from Mac OS X. The syntax is "nvram variable=value". So, for example, to switch to Mac OS 9, I'd type:

% sudo nvram boot-device='mac-io/ata-4@1f000/@0:9,\\\\:tbxi'

(You need to use single quotes, otherwise the backslashes get interpreted by the shell, which is bad. In this forum software, incidentally, you need to use 4 backslashes in your comment to get 1 backslash as output!)

Use 'sudo nvram boot-device' to check that it's set properly. If all else fails, just use System Preferences, which will reset the values to sensible defaults.

You could make a .command file out of this, to be able to double-click it from the Mac OS X desktop. You need to be root to modify NVRAM, which is why "sudo" is used above. I'd like to write a Cocoa wrapper around it at some point, maybe in a couple of weeks when I add the appropriate USB driver support for my keyboard and mouse (no USB Overdrive on X... aargh.)

[ Reply to This | # ]
Quickly setting boot device on Mac OS X
Authored by: sabi on Apr 17, '01 10:44:40PM

Argh, sorry, there should be only two backslashes there (\\:tbxi). Turns out you need 4 backslashes per backslash in preview, but only 2 in post.

Bug fixes, anyone?

[ Reply to This | # ]
Don't just copy this!!! It differs from system to system.
Authored by: Anonymous on Apr 18, '01 05:23:25PM
These values can differ wildly based on your drive setup, the revision of the machine, and whether the ROM is new world (everything with AGP) or old world (everything not AGP). Use the nvram -p command in the terminal to find out the differences. Here is a link to a thread at where I detail this process. Zach

[ Reply to This | # ]
Don't just copy this!!! It differs from system to system.
Authored by: sabi on Apr 19, '01 12:16:54AM

That's a much better description, thanks...

[ Reply to This | # ]
sending password via applescript
Authored by: FrederickFowles on Jan 15, '02 09:20:34PM
I have wrote an apple script to boot me back to 9 in the week mornings after a night of network rendering on X. The only problem is getting the do shell script to send the password after the sudo command, does anyone know how to do this or append it to the sudo command ? Here is the script so far
try repeat set the date_stamp to ((the current date) as string) set current_name to date_stamp set check_weekend to date_stamp set character_countPre to the number of characters of check_weekend as integer set character_count1 to character_countPre - 3 set the check_weekendNew to (characters 1 thru -(the character_count1 + 1) of the check_weekend) as string if check_weekendNew does not contain "Sat" then try if check_weekendNew does not contain "Sun" then try set character_count2 to the number of characters of current_name as integer set character_count3 to ((character_count2 - 11) as integer) set the new_name2 to (characters (the character_count3 + 1) thru -1 of the current_name) as string set new_Date_Stamp to ((new_name2) as string) if new_Date_Stamp = " 9:00:00 am" then try do shell script " sudo nvram boot-device='mac-io/ata-4@1f000/@0:10,:tbxi'" do shell script "sudo reboot" on error beep exit repeat end try end try end try end repeat end try

[ Reply to This | # ]
sending password via applescript
Authored by: ChaChi on Mar 03, '02 04:27:58PM

You can send your password in this format:

do shell script "Terminal commands here" password "Administrator password here" with administrator privileges

Be careful with this because your password gets stored in plain text within the AppleScript. Anyone who knows anything anout AppleScript could view your password. Better to use this:

do shell script "Terminal commands here" with administrator privileges

This will ask the person who runs the script for a password.

Hope this helps...

[ Reply to This | # ]
sending password via applescript
Authored by: RickoKid on Oct 28, '02 09:01:01PM

I came up with this (considerably simpler) script to boot back to OS 9:

display dialog "Are you sure you want to restart in MacOS 9?"
do shell script "sudo /usr/sbin/bless -folder9 '/Volumes/OS 9/System Folder' -setOF"
ignoring application responses
tell application "Finder" to restart
end ignoring

Just change the path to your OS 9 disk (mine is on a different disk called "OS 9", if yours is on the same partition it will be '/System Folder'.

If it doesn't work try removing the 'ignoring application' parts (probably won't work on anything less than 10.2 without these).

Good Luck!

[ Reply to This | # ]
sending password via applescript
Authored by: john8675309 on Jun 16, '03 01:37:44PM

Don't know if I am way to late for this but I have written an entire program that does this in Java it can be found at

[ Reply to This | # ]