Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

Eject all locally mounted disks via AppleScript System
If you're like me, you tend to install several updates and/or software packages at once. When through, I like to eject all my mounted disk images with a simple AppleScript:

tell application "Finder"to eject (every disk whose ejectable is true and local volume is true and physical size < 1.0E+9)

Technically, this doesn't look for mounted DMGs but rather for ejectable, local (ie, non-network) disks with a size less than about 1GB. For most purposes, this will do the job. Copy and paste the above into Script Editor and save the resulting script in ~/Library/Scripts, then access it from the Scripts menu. Alternatively, add it to your tool bar, side bar, or assign it a hot key (with a third party hot key program), etc.

[robg adds: As this script only checks for size and ejectable status, it may have unintended results depending on your system configuration. When I ran it, it ejected one (but not both) of my mounted CDs, but didn't eject the Time Machine disk. I would expect mounted FireWire drives may also be ejected.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[5,757 views]  

Eject all locally mounted disks via AppleScript | 5 comments | Create New Account
Click here to return to the 'Eject all locally mounted disks via AppleScript' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Eject all locally mounted disks via AppleScript
Authored by: DougAdams on Fri, May 30 2008 at 8:24AM PDT
You might want to check the disk's free space property, which would be 0 if it's a CD or DVD.


---
Doug's AppleScripts for iTunes
dougscripts.com

[ Reply to This | # ]
Eject all locally mounted disks via AppleScript
Authored by: packhater on Fri, May 30 2008 at 10:02AM PDT
Did not work for any of my afp, smb or firewire mounted drives. Should it? Or this only fro cds?

[ Reply to This | # ]
Eject all locally mounted disks via AppleScript
Authored by: CajunLuke on Fri, May 30 2008 at 10:08AM PDT
Well, it's not going to work for your afp or smb drives, as they are network disks (i.e. not "local"), and I don't know of any FireWire disks that are less than one gigabyte, so it wouldn't eject those, either. Moreover, the script is intended to not eject those kinds of disks.

[ Reply to This | # ]
Eject all locally mounted disks via AppleScript
Authored by: vocaro on Fri, May 30 2008 at 10:39AM PDT
Eject all locally mounted disks via AppleScript
Authored by: kscotto on Fri, May 30 2008 at 10:41AM PDT
This is what I've been looking for. I changed the value of the disk so that it would eject my USB backup drive (since every time I take my laptop I had to access finder and press Opt and click on the unmount arrow to eject). I assigned the script a hot key via Butler, and now I can eject the disk quickly before I leave with a hotkey combo. Thanks for the tip!

[ Reply to This | # ]