1. Skip to primary content
  2. Skip to secondary content

Sam Rayner

Flying Visits with Boot Camp: The Switcheroo

Within days of my iMac arriving last November, I had partitioned my Macintosh HD and installed Windows using the Boot Camp Assistant. It wasn’t that I missed the familiar Start menu or sand timer of XP, just that there are some things I can’t do in OS X.

I love the simplicity of Boot Camp, but every time I switch and see that loading screen appear I can’t help but be filled with dread. Consequently, I’ve found myself looking for ways to ease the process.

Whenever I boot into Windows, it’s for one of three reasons:

  1. C++ Development (for my A-Level computing course)
  2. Testing sites in IE6 and 7 (thank goodness for Multiple IEs)
  3. Gaming

Having such regimented visits has made it easier for me to slipstream each boot depending on my reason for switching. I can go in, do what I need to do and get back to Leopard as soon as possible.

This post will hopefully be the first of many on little things designed to take the pain out of switching OS and minimise your time spent in Windows.

One-Click Reboots with AppleScript

On my desktop, there’s an alias labelled “XP Boot” that lets me quickly switch between operating systems with minimum hassle. To create your own, paste the following into Script Editor (located in the AppleScript directory in Applications):

set white_list to {"Finder"}

try tell application "Finder" set process_list to the name of every process whose visible is true end tell repeat with i from 1 to (number of items in process_list) set this_process to item i of the process_list if this_process is not in white_list then tell application this_process quit end tell end if end repeat on error tell the current application to display dialog "An error occurred!" & return & "This script will now quit." buttons {"Quit"} default button 1 with icon 0 end try
do shell script "bless -mount '/Volumes/WINDOWS VOLUME/' -legacy -setBoot -nextonly" password "PASSWORD" with administrator privileges do shell script "shutdown -r now" password "PASSWORD" with administrator privileges

The first half of the script quits all running applications (apart from Finder) and the second sets the boot partition to your Windows drive before restarting. The script does not set Windows as the default OS, just enables it for the next boot.

You’ll need to change WINDOWS VOLUME to whatever your C:\ drive is called ("Untitled" by default; if you want to change it, you’ll have to boot into Windows, right click it in My Computer and set a name in Properties). Both PASSWORD placeholders will also have to be filled with your admin password.

If keeping your Mac secure from snooping guests is a factor, you’ll want to remove both password "PASSWORD" segments from the script. It will still work but will prompt you for an admin password every time it runs. If you leave the password in, it will be readily available to anyone who knows what they’re doing but will save you the hassle of typing it every time.

Once you’ve changed the volume name and passwords, hit compile and save the script with File Format set to Application. If you wish to receive a confirmation dialogue before your Mac reboots, tick Startup Screen under Options.

XP Boot Alias Example

Now just create an alias for the script wherever you like, perhaps give it a pretty icon, and you’re away!

In future posts, I’ll share some tips on saving time once you’re successfully booted in Windows.

Your Thoughts?

* Required

Options

Some basic HTML allowed. Please keep all comments constructive, polite and on-topic. Any spam or offensive comments will be deleted.

Gravatar Preview

Comments (Post One)

#1 Mark James’s Gravatar Mark James (6 months, 2 weeks ago)

I was forced to discover this same tip for myself a few months ago when I realised that bringing up the boot menu by holding down the Alt key as I started the ol’ MacBook Pro no longer worked after replacing my old keyboard with one of the new Apple flat ones. Glad I was forced to do so though.

As for C++ development, have you tried running Borland (and whatever other 1990s throwback applications they’re making you use ;) via Parallels (or VMWare), using your Boot Camp volume as your mounted Windows volume for Parallels?

#2 Sam Rayner’s Gravatar Sam Rayner (6 months, 1 week ago)

I do have my Boot Camp volume set up with Parallels, which makes everything a whole lot simpler. I haven’t really tried using C++Builder within it though.

I think the main reason is fear of crashing Windows through some stupid infinite loop and having to quit Parallels without shutting XP down properly. Soon after I first set it up I did just that and it corrupted the volume (try closing the Parallels window normally when it’s running—it warns you about it). At least running it natively means I can just kill the power.

Another upside is that it takes all of the beautiful distractions away :)

#3 Dave Hopton’s Gravatar Dave Hopton (6 months, 1 week ago)

Nice tip as usual, although you’ve already passed this on to me :) I always use this script now.

On closing the stuff with Finder, I did it through Automator, but knowing the Applescript is useful.

Do you get your snippets of Applescript from a database site of sorts, or just Google? There are a couple of things I’d like to try but I don’t know the code, let alone whether it’d be possible.

#4 Sam Rayner’s Gravatar Sam Rayner (6 months, 1 week ago)

I just whack keywords into Google. The scripts are usually supplied by people on forums responding to a particular request. MacScripter and the official AppleScript discussion forum are good for a browse though.

#5 Jonathan Evans’s Gravatar Jonathan Evans (6 months, 1 week ago)

Firstly, Nice website *Jealous*.

May be worth trying to run BCB from within OSX using wine as it can now be compiled on Intel Macs. C++ Builder 4 works using wine on Linux so it *should* work on OSX.

I don’t think IE6 / 7 will wok in wine due to its implementation however a long time ago I stumbled across browsershots. This crazy website visits a chosen page in many different browsers and platforms displaying the screenshots so you can see how they render.

#6 Sam Rayner’s Gravatar Sam Rayner (6 months, 1 week ago)

Cheers for the tip Jon. I think I’ll keep my C++ to Windows for now just to make things easier but thanks anyway. I plan to give Objective-C and Cocoa a go once I have some of the basics under my belt, so I’ll wait for that before compiling for OS X.

I actually posted a quicklink to IEs 4 OS X the other day. It lets you install IE6 and (a little unstably) IE7 with a custom build of wine. I have used Browsershots in the past but it won’t replace being able to refresh in Parallels I’m afraid.

You running Linux at the moment then?

Post a Comment