Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to open/close an external CD/DVD via keyboard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to open/close an external CD/DVD via keyboard
Authored by: rvamerongen on Feb 15, '05 12:37:14PM

This is a nice way to open the external drive.

But I have two pioneers and a cd drive

Vendor Product Rev Bus SupportLevel
1 PIONEER DVD-RW DVR-108 1.06 FireWire Vendor Supported
2 PIONEER DVD-RW DVR-104 A227 ATAPI Apple Shipping

The thirth is not found by drutil, but is also in the firewire case and works normal.

What do you think that I need to change to your script to let it work with my drive's? I did try several things but it didn't work

Thanks



[ Reply to This | # ]
Filter by bus type (FireWire, ATAPI)
Authored by: gatorparrots on Feb 15, '05 01:32:51PM
The change is fairly simple. Instead of relying on vendors, it would be better to filter by the bus type (the internal ATA, or external FireWire or USB):
#!/bin/sh
##==================================================
# opensesame -- open/close external optical drives
##==================================================
if [ -z $(uname -r | grep "7.") ]; then
    echo "Sorry, $(basename $0) require OS X 10.3+"
    exit 1
fi
if [ -z "$1" ]; then
    echo "usage: $(basename $0) -c (closes external optical drive)"
    echo "       $(basename $0) -o (opens external optical drive)"
    exit 1
fi
theDRIVE=$(/usr/bin/drutil list | awk '/(FireWire)|(USB)/ {print $1}')
if [ "$1" = "-c" ]; then
  drutil tray close -drive $theDRIVE
elif [ "$1" = "-o" ]; then
  drutil eject -drive $theDRIVE
fi


[ Reply to This | # ]
A script to open/close an external CD/DVD via keyboard
Authored by: sidekickr on Feb 15, '05 01:33:22PM

I believe that if you replace the "LITE_ON" with "PIONEER DVD-RW DVR-104" that the DVR-104 would be controled by the bash script. You may have to escape the spaces to be something along the lines of "\ " I can't test this due to lack of Mac access at the moment, but it should work.



[ Reply to This | # ]
A script to open/close an external CD/DVD via keyboard
Authored by: mark hunte on Feb 15, '05 02:04:09PM

For does who have only one external you could use

#!/bin/bash

if [ "$1" = "-c" ]; then
drutil tray close -drive external;
elif [ "$1" = "-o" ]; then
drutil eject -drive external ;
fi

---
mh



[ Reply to This | # ]
A script to open/close an external CD/DVD via keyboard
Authored by: jimhoyt on Feb 15, '05 03:59:57PM
If you've just got one external drive you could just fire off this Applescript:

property drawerstatus : true

if drawerstatus is true then
    do shell script "drutil eject -drive external"
else
    do shell script "drutil tray close -drive external"
end if
set drawerstatus to not drawerstatus
Attach it to a key using System Preferences or your method of choice. The first press will open the tray and the next will close it. Worst case, it takes two presses if something interferes with the tray.

[ Reply to This | # ]
A script to open/close an external CD/DVD via keyboard
Authored by: mark hunte on Feb 15, '05 04:59:11PM

I have tried before to attach a script to keys using the keyboard and mouse prefs. but never could get it to work. any clues as to how to do this.


---
mh



[ Reply to This | # ]
A script to open/close an external CD/DVD via keyboard
Authored by: pismomac on Feb 15, '05 03:58:16PM

My understanding is that this will only work with a "burner" drive.
CD-RW, DVD-RW, CD-R, DVD-R, etc.

If I am wrong I apologize.



[ Reply to This | # ]