// a quick way to play a DVD that has been saved to the hard drive
-- a quick way to play a DVD that has been saved to the hard drive
-- adapted from a script found in the comments of this article: http://www.macosxhints.com/article.php?story=20050924210643297
-- Instructions for use:
-- 1. Paste this script into Script Editor and save as an application bundle to ~/Library/Scripts/Applications/Finder/Play DVD Folder
-- 2. Control-click and drag it to the top of a finder window so it appears in every finder window.
-- 3. Next, we'll give our script the DVD Player icon to make it's use more intuitive by entering these commands in Terminal:
-- $ cd ~/Library/Scripts/Applications/Finder/Play\ DVD\ Folder.app/Contents/Resources/
-- $ rm droplet.icns
-- $ cp /Applications/DVD\ Player.app/Contents/Resources/app.icns droplet.icns
-- $ touch ~/Library/Scripts/Applications/Finder/Play\ DVD\ Folder.app
-- 4. In the Finder, drag a DVD Folder onto the "Play DVD Folder at the top of that finder window".
-- 5. Enjoy the movie. :-)
-- script was opened by click in toolbar
on run
tell application "Finder"
try
set currFolder to (folder of the front window as string)
on error
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end tell
CD_to(currFolder, false)
end run
-- script run by draging file/folder to icon
on open (theList)
set newWindow to false
repeat with thePath in theList
set thePath to thePath as string
if not (thePath ends with ":") then
set x to the offset of ":" in (the reverse of every character of thePath) as string
set thePath to (characters 1 thru -(x) of thePath) as string
end if
CD_to(thePath, newWindow)
set newWindow to true -- create window for any other files/folders
end repeat
return
end open
-- open and play the movie
on CD_to(theDir, newWindow)
try
tell application "DVD Player"
activate
if theDir ends with "VIDEO_TS:" then
set videoTS to theDir as alias
else
set videoTS to theDir & "VIDEO_TS:" as alias
end if
open VIDEO_TS videoTS
set viewer full screen to true
play dvd
end tell
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end CD_to