10.3: Eject your external CD drive from the keyboard

Mar 17, '04 09:53:00AM

Contributed by: SJT

I've got an external FireWire CD writer, and one thing that's really irritated me is having to nudge the tray until it pulls it back in. However, I've just found drutil in Panther; it lets you control your cd writers from the command line, including ejecting and closing the tray! Using one of the freeware F-key modifiers, i've saved this applescript as an application and attached it to F15:

set home to path to home folder as string
set mypath to home & "discCheck"
set testVar to true
try
  set mypath to mypath as alias
on error
  set testVar to false
end try

if testVar is true then
  do shell script "drutil tray eject; rm -f ~/.discCheck"
else
  do shell script "drutil tray close; touch ~/.discCheck"
end if
[robg adds: A previous hint talked about using drutil and cron to automatically close the internal CD tray...]

Comments (16)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040313065158194