Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
bennetsaysargh said:
if it can, how would you put that into applescript?

thanks :)

I just tried it myself, but I can only get it to work for a specific CD in the tray

tell application "Finder"
eject "CDName"
end tell

I'm not sure how to eject any CD or to just cause the tray to open
 
bennetsaysargh said:
if it can, how would you put that into applescript?

thanks :)

Not sure how to do it with Apple Script to ``eject all''

You can do it with a unix shell script, however.

You'll need to figure out what disk # your CD/DVD unit is.

Then you could create a script via your favorite unix shell that has in it something like (for my powerbook):

disktool -e disk1 (or you could just execute this yourself by typing it in on the terminal command line)

This method will work when the eject menu and/or key combinations fail as well.
 
BrandonRP0123 said:
Not sure how to do it with Apple Script to ``eject all''

You can do it with a unix shell script, however.

You'll need to figure out what disk # your CD/DVD unit is.

Then you could create a script via your favorite unix shell that has in it something like (for my powerbook):

disktool -e disk1 (or you could just execute this yourself by typing it in on the terminal command line)

This method will work when the eject menu and/or key combinations fail as well.

how do i find out what disk # my cd/dvd drive is?
 
Well, if you can do it with the Terminal, you can do it using AppleScript using the Terminal. ;)

Code:
tell application "Terminal"
	activate
	do script "disktool -e disk1"
        quit
end tell

Of course, if you keep the Terminal application open, remove the line with "quit" in it.
 
That works fine as long as something is in the drive. It reports the following:

disk2s1s2 device will attempt to be ejected ...
***Notifications Complete for type 1
***Responding yes to unmount - disk2s1s2
***Disk Unmounted('disk2s1s2')
***Disk Unmounted('disk2')
***Notifications Complete for type 4
***Responding yes to eject - disk2
***Responding yes to eject - disk2s1
***Responding yes to eject - disk2s1s1
***Responding yes to eject - disk2s1s2
***Disk Ejected('disk2')
***Disk Ejected('disk2s1s2')
 
If you don't want to have the terminal come up to do the script then you can do this...

Code:
do shell script "disktool -e disk1"

Or you can get really hard-core applescripter and use the "disktool" terminal command to get the list of disks, then tell you what disks there are, and allow you to select from a list the disk you want, and have it ejected, but you might have to spend some time reading the Applescript Studio docs, I don't have time to help you with that right now. Cheers!
 
in Terminal this command is probably the easiest:

drutil tray eject

that's it. of course you could easily have AppleScript tell the Terminal to run this as you normally would.
 
hey, thanks everyone :)
Code:
do shell script "drutil tray eject"
do shell script "drutil tray close"
that's what i am using. is there any way you can make applescript wait a few seconds? i ask this because if you ask it to repeat, it starts closing, but opens back up.

thanks again :)
 
bennetsaysargh said:
hey, thanks everyone :)
Code:
do shell script "drutil tray eject"
do shell script "drutil tray close"
that's what i am using. is there any way you can make applescript wait a few seconds? i ask this because if you ask it to repeat, it starts closing, but opens back up.

thanks again :)

Of course there is. :D
 
bennetsaysargh said:
do you know how? :p

edit-also, does anyone know if you can make something force quit in applescript?

I'm going to have to get you a link to the information or buy you a book. :p

delay 10

to delay for 10 seconds

You can use the kill shell script command if you know information about the job you want to force quit.
 
hey, i want to do the same thing but when i put

do shell script "drutil tray eject"

into applescript and hit run i get an error, it says

sh: drutil: command not found

any help? i am running 10.2.8 if that matters on applescript beta 2.0 and the tcsh shell or whatever it is called in terminal

thanks
 
yippy said:
hey, i want to do the same thing but when i put

do shell script "drutil tray eject"

into applescript and hit run i get an error, it says

sh: drutil: command not found

any help? i am running 10.2.8 if that matters on applescript beta 2.0 and the tcsh shell or whatever it is called in terminal

thanks

If you don't mind me asking what mac are you using? If you are using an old world mac (ADB-- keyboard and mouse) then i think that by pressing the F12 key it opens the cd tray, the master drive that is. but, i'm sure that you knew this. :D
 
yippy said:
hey, i want to do the same thing but when i put

do shell script "drutil tray eject"

into applescript and hit run i get an error, it says

sh: drutil: command not found

any help? i am running 10.2.8 if that matters on applescript beta 2.0 and the tcsh shell or whatever it is called in terminal

thanks

take a look at the manual page for drutil. i don't think it is included in OS 10.2.x perhaps you can download it somewhere though. i should have said that earlier, sorry. this works in Panther only, unless you install it yourself in 10.2.x
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.