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


Click here to return to the 'Choose startup disk via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Choose startup disk via AppleScript
Authored by: Swordfish on Jan 29, '07 11:43:56AM
iMac Core Duo (Early 2006):

-If I'm booting in Windows by default and I want to change the boot drive to Mac OS X, the script works fine.
-If I'm booting in Mac OS X by default and I want to use the script to switch to Windows, the script doesn't work (the system just reboots in OS X).

What gives?

PS: the --nextflag option also works when Windows is default and I want to go in OS X, but not when OS X is default and I want to go in Windows!

[ Reply to This | # ]

Choose startup disk via AppleScript
Authored by: AJB on Jan 29, '07 12:24:03PM

How do you run an AppleScript if you are booted into Windows???

Or do you mean, the default boot drive is Windows, but you happen to have booted into OS X, and this scrip works?

I'm not sure if bless is will handle setting Windows volumes (I've never run Boot Camp on my mac). You might want to check out the --bootefi option



[ Reply to This | # ]
Choose startup disk via AppleScript
Authored by: Swordfish on Jan 29, '07 02:19:38PM

I'll explain what I did, what worked and what didn't.

===
Booted in OS X
Default startup disk is Windows
I run the script (to boot in OS X)
The computer reboots in OS X **script is working**
===
Booted in OS X
Default startup disk is Macintosh HD
I run the script (to boot in Windows)
The computer reboots in OS X **script fails**
===
Booted in OS X
Default startup disk is Windows
I run the script (to boot in OS X) with --nextonly
The computer reboots in OS X once
The computer boots in Windows on the following reboots **script is working**
===
Booted in OS X
Default startup disk is Macintosh HD
I run the script (to boot in Windows) with --nextonly
The computer reboots in OS X **script fails**

BTW, I think the problem is not the Applescript itself, but the command line actions.



[ Reply to This | # ]
Choose startup disk via AppleScript
Authored by: Greville on Jan 30, '07 01:39:21AM
Hi Swordfish, You need to add the -legacy option, I use the following to reboot into windows:
do shell script "bless -mount /Volumes/yourWindowsVolume/ -legacy -setBoot -nextonly" password "yourPassword" with administrator privileges
do shell script "shutdown -r now" password "yourPassword" with administrator privileges
Just replace 'yourWindowsVolume' with your Bootcamp partition and 'yourPassword' with your admin password. NOTE: Having your admin password in plain text like this creates security issues for publicly accessible machines. If this is a concern you can lock down access to the script or simply remove 'password "yourPassword"' and the script will prompt people for the password.

[ Reply to This | # ]
Choose startup disk via AppleScript
Authored by: Swordfish on Jan 30, '07 03:37:12PM

You are awesome! Many thanks, works like a charm! :)



[ Reply to This | # ]