I've recently set my computer to hibernate instead of sleep, but I've found that when the computer hibernates, external drives are not ejected properly. I found an AppleScript command that ejects everything, but that includes the disc in the CD/DVD drive (which I don't want to be ejected). Here's the script I have at this point:
Basically what I want it to say is:
...where "isCDdrive" is something that the computer would actually understand. So what I'm asking is does anyone know what the generic descriptor of the computer's CD/DVD drive is?
UPDATE:
I changed the script to say:
This does the trick for now. Even when there is a blank CD where I have read and write privileges, it's not ejected with this script. The only problem I can see at this point is if I have an external drive that is read only. If that ever happens, it won't be ejected; however, I don't know if a read only drive can be damaged if removed without being ejected.
If anyone knows if a read only drive can be damaged if removed without ejecting, or if anyone knows of a better way to script this, feel free to post.
UPDATE:
I've found a new problem. If I mount a disk image, and I have write privileges, it will be ejected when I run the script (which I don't want to happen), so an alternative to the script I have now would be preferred.
Code:
tell application "Finder" to eject (every disk whose ejectable is true)
tell application "System Events"
sleep
end tell
Basically what I want it to say is:
Code:
tell application "Finder" to eject (every disk whose isCDdrive is false)
tell application "System Events"
sleep
end tell
UPDATE:
I changed the script to say:
Code:
tell application "Finder" to eject (every disk whose owner privileges is read write)
tell application "Finder" to eject (every disk whose owner privileges is write only)
tell application "System Events"
sleep
end tell
This does the trick for now. Even when there is a blank CD where I have read and write privileges, it's not ejected with this script. The only problem I can see at this point is if I have an external drive that is read only. If that ever happens, it won't be ejected; however, I don't know if a read only drive can be damaged if removed without being ejected.
If anyone knows if a read only drive can be damaged if removed without ejecting, or if anyone knows of a better way to script this, feel free to post.
UPDATE:
I've found a new problem. If I mount a disk image, and I have write privileges, it will be ejected when I run the script (which I don't want to happen), so an alternative to the script I have now would be preferred.