To save wear and tear on my Superdrive I have copied two two DVDs that my daughter watches constantly into my HD using
DVDbackup. In order to make them easy to play, I have built my first AppleScript, which I attached to the folder containing the video files using Folder Actions. When the folder is opened, the script opens DVD Player, selects the right media and presses Play. I have updated the folder icons with pictures of the cartoon characters that feature in the movie.
on opening folder this_folder
tell application "Finder"
activate
close window of this_folder
set this_name to the name of this_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
I'm sure someone can tell me how to hide, rather than close, the folder window and un-hide it if the user answers 'no' to the dialog. I find the AppleScript documentation a litte obtuse!