 |
 |
Open/Close External CD Drive
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
I know how to make my external CD burner open its tray:
Code:
do shell script "drutil tray eject -drive external"
and I know how to make it close again:
Code:
do shell script "drutil tray close -drive external"
What I can't figure out is how to make it close if currently open and/or open if curently closed; i.e., check its open/closed status. After determing the status, a simple if/then statement based on that info hould do the trick, right?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
Why do you even need those conditionals?
I mean, what harm is there in telling an already ejected tray to eject? Nothing happens.
I just tested it and there's no harm in issuing drutil eject over and over. Likewise with drutil tray close.
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally posted by Kristoff:
Why do you even need those conditionals?
I mean, what harm is there in telling an already ejected tray to eject? Nothing happens.
I just tested it and there's no harm in issuing drutil eject over and over. Likewise with drutil tray close.
No, it does no harm. But I still would rather not issue a frivolous command; it's bad practice. Besides, when the drive is open, I want it to close, and when it's closed, I'd like it to open. My plan is to tie the AppleScript to a key on my Macally keyboard.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status:
Offline
|
|
Make an invisible file in your user ~/Library/Preferences folder whenever you open the drive tray.
Then in your script, check for the presence of the file.
Pseudo-code:
Code:
if exists file ~/Library/Prefereces/.cdstatusopen
{
close drivetray
delete file .cdstatusopen
}
else
{
open drivetray
create file .cdstatusopen
}
Even if it gets out of sync (i.e. you use the button on the drive), just press your macro key again and it will resync itself.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
Does the Macally keyboard not have an eject key?
Anyway, you might lauch drutil poll, then watch the messages as you open and close the drive. It will provide some insight.
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|