View Full Version : Force eject disk with applescript
masterp34588
Sep 25, 2009, 12:23 AM
I've spent the past 30 minutes toying around with getting applescript to run the following terminal command:
"drutil tray eject"
I would like this command to be in my applescript menu so whenever I get a CD stuck in my iMac (which is often) I can just run the applescript instead of having to google the command above. What's the easiest way to go about this? I'm on Snow Leopard.
lancestraz
Sep 25, 2009, 09:56 AM
Very easy.
do shell script "drutil tray eject"
Consultant
Sep 25, 2009, 11:08 AM
Perhaps the source of the problem: don't scratch your cds?
chown33
Sep 25, 2009, 11:15 AM
Apple provides an menu extra that adds an Eject icon to the right side of the system menubar.
http://www.creativetechs.com/tips/quicktips_51.html
Summary:
Go to /System/Library/CoreServices/Menu Extras
Double-click Eject.menu.
Observe: Eject icon is added to menubar.
Command-drag to move on menubar, or cmd-drag off menubar.
I've been using the Eject menu-extra for a long time.
foidulus
Sep 25, 2009, 11:16 AM
Perhaps the source of the problem: don't scratch your cds?
There are actually other reasons cds get stuck. At work some of our users switched to Vista(well, were forced to), and Vista by default writes disk in a flavor of UDF that only Vista supports. Leopard went nuts(disk utility thought there were a total of 4.1 billion files taking up 1 meg of space) and would not eject the disc through all the normal means. It had to be force ejected and that failed on occasion(had to bounce the machine and eject the disc before the OS booted). So there are other reasons for discs getting stuck....
So maybe the real moral of the story is, "Take care of your optical media, don't scratch them and don't EVER let them anywhere near Vista" :p
masterp34588
Sep 26, 2009, 03:43 AM
Very easy.
do shell script "drutil tray eject"
Thanks so much!
dXTC
Sep 26, 2009, 09:48 AM
Apple provides an menu extra that adds an Eject icon to the right side of the system menubar.
http://www.creativetechs.com/tips/quicktips_51.html
Summary:
Go to /System/Library/CoreServices/Menu Extras
Double-click Eject.menu.
Observe: Eject icon is added to menubar.
Command-drag to move on menubar, or cmd-drag off menubar.
I've been using the Eject menu-extra for a long time.
This rawks! Thanks!
Damir Mustafic
Oct 2, 2009, 09:49 AM
I installed SL, rebooted and my CD drive quit working.
When booting I hear it initialize, but when I push the CD media in, it doesn't take it. I tried ejecting and when i press the eject key, I don't see the icon on the screen anymore.
This happened right after the Snow install. Tried ejecting from shell, command executes but still can't "push" the media in.
Alexandra Frei
Apr 25, 2011, 09:10 AM
Very easy.
do shell script "drutil tray eject"
Many thanks buddy, I was nearly destroyed not to get out this dm... DVD, thinking in a computer GAU.
But it was helping perfectly ... shhowww the disk was out.
Alexandra
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.