Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a MacBook Pro, and when on my desk it is connected to a thunderbolt display. And I have an external hard drive connected to my thunderbolt display. This hard drive has 2 partitions and contains my iTunes library, as well as other things I rarely need when away from my desk.

When I remove my laptop from my desk, I need to perform a few steps or else I can potentially corrupt files on the external drive during the forceful disconnect. This has happened a few times, and I have had to restore backups of my iTunes library or other files. This is becoming a huge pain everytime I wish to remove my computer from my desk.

  1. Quit iTunes (if open) since the iTunes library file is on the external disk.
  2. Open a finder window.
  3. Click the "Eject" button on one of the 2 partitions
  4. Click the "Eject All" button in the dialog that appears asking if I want to eject all partitions on that physical disk or just one.

I'm not familiar with scripting or automation tools on OSX. But is it possible to create some sort of automation script that I could activate with a single click in the dock? Or perhaps via spotlight? And what would such a script look like?

share|improve this question
up vote 2 down vote accepted

OSX has a built-in application called Automator which can useful for this sort of thing. Mac 101: Automator

This allows you to set up a list of automated actions from a GUI rather then messing with scripts. I think the following is more or less what you are looking for:

  1. Start /Applications/Automator
  2. Choose "Workflow" for your new document
  3. Add the following actions in this order:
    1. "Quit Application" (from Utilities), then Select "iTunes"
    2. "Get Specified Finder Items" (from Files & Folders), then add the partition(s) you wish to eject
    3. "Eject Disk" (from Files & Folders)

The completed workflow should look something like this

You can test the workflow in the Automator app and you can save so you can run it later, just by double-clicking it.

share|improve this answer
You're my hero. Thank you! – Alex Wayne Mar 6 '13 at 0:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .