DVD script

Hi there - first post so be gentle!

(this is using Folder Actions btw)
I have recently come accros an applescript in the uk magazine MacFormat that launches DVD player when you open a specific folder, it then tells dvd player to look for a video_ts folder within the opened folder and starts playing it. Unfortunately, after copying the script exactly (i think) i still cant get it to work!

here is the script:

on opening folder this_folder
tell application “Finder”
activate
close window of this_folder
set this_name to the name of ths_folder
display dialog “Would you like to play the movie?” & ¬
this_name buttons {“Yes”, “No”} default button 1 giving up after 5
set the user_choice to the button returned of the result
end tell
if the user_choice is not “No” then
try
tell application “DVD Player”
activate
open VIDEO_TS this_folder
set viewer full screen to true
play dvd
end tell
on error number errNumber
display dialog errNumber buttons {“OK”} ¬
default button “OK” with icon 2
end try
end if
end opening folder

where am i going wrong?!
any help would be much appreciated!

Becan

no-one able to help me out?

am i being really stupid about the script?

You will probably have an easier time with this script. The primary portion of it came from a script on Mac OS X Hints, I added the ability to drop the container of the VIDEO_TS folder and have it play.

Simply save the script as a droplet and you should be ready to go.


on ProcessAFolder(aFolder)	
	--check if folder is VIDEO_TS
	set checkPath to aFolder as text
	if checkPath contains "VIDEO_TS" then
		playDVD(aFolder)
	else
		set aFolder to (checkPath & ":VIDEO_TS" as alias)
		playDVD(aFolder)
	end if	
end ProcessAFolder

on open of folderList	
	repeat with aFolder in folderList
		ProcessAFolder(contents of aFolder)
	end repeat
end open

on run	
	set theFolder to choose folder
	ProcessAFolder(theFolder)
end run

on playDVD(aFolder)
	try
		tell application "DVD Player"
			activate
			open VIDEO_TS aFolder
			set viewer full screen to false
			play dvd
		end tell
	on error errMessage number errNumber
		display dialog errNumber & return & errMessage buttons {"OK"} ¬
			default button "OK" with icon 2
	end try
end playDVD

Did you attach that script (the original one) to a folder as a folder action? Are folder actions even enabled?

I do have folder actions enabled and attached the script, though I am not having any luck with it either. When I open the folder it does not seem to do anything.

I am not familiar with writing folder actions. Sorry.

thanks for your help biscuit, much appreciated!

sorry if i’m being a bit thick but what do you mean attach the code to a droplet?

yeah, i was origionally trying to do this as a folder action simply so that when i open the folder it automatically runs the script - play the folder in dvd player.

i know this is possible but just doesn’t seem to be working!

thanks for your help,

Becan

sorry, just worked out what you meant when you say save it as a droplet!

this works great but i still have to drag the folder onto the script everytime. There must be some way of getting this to work with folder actions - i just can’t work it out.

Becan