Eject All

Every day I unplug my MacBook Pro from a set of disks and other peripherals at home, take it into the office and plug it into a new set there. In the evening, I do the same going home.

One thing that makes this much less painful than it might otherwise be is a keystroke shortcut I set up a long time ago, based on this hint. Now I just type Cmd-F1, and all my external disks are unmounted. This is exceedingly handy!

To do this, create an AppleScript containing the following:

tell application "Finder"
	set bootDisk to name of startup disk
	set otherDisks to every disk whose (name is not bootDisk)
	repeat with myDisk in otherDisks
			eject myDisk
		end try
	end repeat
end tell

Save it somewhere and configure your favourite utility to run it. I use QuickSilver and set it up as a trigger.

It won’t work, of course, if you have an application running using one of the disks, so it’s good to check the Finder window before actually unplugging them.

Got Something To Say:

Your email address will not be published. Required fields are marked *


To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

© Copyright Quentin Stafford-Fraser