Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Eject DVD using Applescript?

Eject DVD using Applescript?
Thread Tools
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status: Offline
Reply With Quote
Feb 17, 2007, 11:22 PM
 
Any idea how to do this?
The eject command needs you name the volume, I just want to eject any DVD in the drive?

Thanks.
     
Fresh-Faced Recruit
Join Date: Feb 2007
Location: California
Status: Offline
Reply With Quote
Feb 18, 2007, 01:00 AM
 
IF you can integrate this to apple script it should work.

1. Type the command drutil list into the Terminal and press return . This will provide a list of all currently connected removable devices. -- connect FireWire/USB drives for this

2. Use the command drutil tray eject 1

In the above command, the number "1" should be replaced with whatever drive number you obtained in the first step.
(Last edited by PSXBatou; Feb 18, 2007 at 03:17 AM. )
     
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status: Offline
Reply With Quote
Feb 18, 2007, 03:13 AM
 
Wow, thats great thanks!

One more thing, I don't know if this is possible but can you suggest a way to check if the drive tray is open?

I want to do this
if drive tray is open
then
do shell script "drutil tray close 1"
else
do shell script "drutil tray eject 1"
end if
     
Fresh-Faced Recruit
Join Date: Feb 2007
Location: California
Status: Offline
Reply With Quote
Feb 18, 2007, 03:18 AM
 
Originally Posted by moonmonkey View Post
Wow, thats great thanks!

One more thing, I don't know if this is possible but can you suggest a way to check if the drive tray is open?

I want to do this
if drive tray is open
then
do shell script "drutil tray close 1"
else
do shell script "drutil tray eject 1"
end if
It should work, give it a shot. If it does let me know (and give me a copy of the script please)
     
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status: Offline
Reply With Quote
Feb 18, 2007, 03:22 AM
 
Any idea on how to check if the drive is open?
     
Senior User
Join Date: Oct 2004
Location: Portugal
Status: Offline
Reply With Quote
Feb 18, 2007, 12:15 PM
 
try this (save as appescript and run it):
(it still doesn't check if the tray is open, but can do both the open and close...)

property last_choice : "Open"

--comment out the next line to have it run without user interaction:
set last_choice to button returned of (display dialog "Open or close the drive tray?" buttons {"Close", "Open"} default button last_choice with icon 1)
if last_choice = "Open" then
do shell script "drutil tray open -drive 1"
set last_choice to "Close"
else
do shell script "drutil tray close -drive 1"
set last_choice to "Open"
end if
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:46 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2