Querying the system for the path to DVD drive via applescript

Hey Guys…somewhat of a newbie here.

I work for a library and we check out Foreign Standard and Regular DVDs to be watched on our Macs. However Apples DVD Player doesn’t like to play Foreign Standard DVDs while VLC does, to aid our patrons (who are often times extremely computer illiterate) I wrote the following script (I edited outthe dialogue to keep it brief).

set dialogResponse to button returned of (display dialog "Dialog" buttons {"Standard DVD", "Foreign DVD", "Cancel"} default button 1 with icon note giving up after 20)
--
if dialogResponse is "Foreign DVD" then
	try
		tell application "VLC"
			activate
			open ":dev:rdisk1"
			delay 5
			play
		end tell
	on error
		display dialog "Dialog" buttons "Ok" default button 1 with icon caution giving up after 10
	end try
else if dialogResponse is "Standard DVD" then
	tell application "DVD Player"
		activate
	end tell
end if

My script worked perfectly…that is until I tried it on a couple of our machines have multiple HDs…and then some of our patrons use flash drives…grrrrr. So depending on what the configuration was “:dev:rdisk1” was not always the path to the DVD drive.

Any clue on how to query the system for the path? I know in tcsh I can write “diskutil list” and it list all the drives and their paths…but I as I started pursuing that thought I ended up thinking this script was going to be a lot more complicated then it was worth.

Thanks in advance for any advice!

if i undersatnd correctly what you’re lookin for, then there’are several ways to achieve it.

here are some:

if having to point to the dvd manually is acceptable, then you can try:


set the_dvd to choose folder -- choose the dvd disk
set the_dvd to POSIX path of (the_dvd as text) --path to the dvd 
-- your script.

or


do shell script "ls -f /Volumes"
set the_dvd to (paragraphs of the result)
set the_dvd to choose from list thedisks --list of disks
set the_dvd to POSIX path of (the_dvd as text) --path of the dvd
--your script...

if you want to have the script running as soon as the dvd is inserted, then you can automatically get a reference to the dvd, using “digital hub scripting” :


on video DVD appeared the_dvd
	set the_dvd to POSIX path of (the_dvd as text) -- path to the dvd inserted
	display dialog "the dialog"
	-- open the_dvd with the chosen application
	--etc.
end video DVD appeared

you’ll have to assign this script to an action in system perfs…
you can also attach a folder action to your /Volumes…

hope this helps.