APPLE script help Please!!!

cclear

Registered
Please help a newbie-apple-scripter out.. :)
I just want to have a simple little apple script to launch a DVD movie folder that is stored on my HD.. basicly, lets say I have a bunch of DVD's copied on to the HD for play back ( I don't yet, but I will later ) I want a simple apple script .app that I can click to launch a movie..

say I have a Script .app that is called Moulin Rouge. When Clicked, It launches the video_ts folder and plays fullscreen on the Screen

I KNOW the syntax is incorrect, but this is what I want to do, how do I say it right??

tell application "DVD Player"
activate
open folder in "VIDEO_TS" in folder "MoulinRouge" in folder "DVD" on hard drive "Bob's_HDrive" on computer "Bob"
Play full screen
end tell


The idea is to take this and just copy the script for whatever movie I wish to have a script .app -- I just have to change the name of the script and the path..

what is the syntax for a file path in applescript??
 
I believe it's "of folder" and "of disk".

The easiest way, however, is this:
In the finder, find the folder you want the path to. Select it and choose copy from the edit menu. Go into script editor, put the cursor where you want the path and go to edit>paste reference. Hey presto, you've got the full path to the folder.
 
Scaryfish: thanks!! paste reference is very cool..

I still can't get the exact syntax to work yet..

the path is correct, but how do I tell the "DVD player" to open the "TS_FOLDER" and then tell it to play it at full screen
( because the DVD player by default doesn't automaticly start playing DVD folders, and it is in a window viewer )

see below for what I got so far..(applescript app) I still just can't seem to find anything to help me narrow down syntax for telling the DVD player what I want it to do..

tell application "DVD Player"
activate
open folder "VIDEO_TS" of folder "Moulin Rouge" of folder "DVD" of startup disk
Play
Viewer at Full Screen
???????
end tell
quit
 
Ok, try this: Go into script editor, go to file>open dictionary. Select your DVD player from the list and click ok.

This gives you a list of all the commands the player understands, and their syntax.

I don't have DVD player 'cause I don't have a DVD drive, so I can't really help from experience.
 
scaryfish: thanks for your help so far.. I know this is probably simple stuff, I just haven't got a grip on it yet...
man, I don't know why I didn't look at the dictionary b4.. VERY cool..

I am just 1 step away now from getting this to work.. ( this is the first script I have ever made!! it is very exciting.. ;) iknowiknow goofy cheezy little thing.. but apple script is soo COOL!! especially with dictionary to narrow things down.. I am no programmer, but I would be cool to make little simple scripts and such...

I am still having issues getting the script to see the path name - everything below works correctly, but it doesn't seem to accept the file structure.. under dictionary for opening a VIDEO_TS ( thats what I need ), it says
open VIDEO_TS file specification -- file reference to VIDEO_TS folder

but when I try it - it gives me a
(expected end of line,ect. but found " )
and highlights the first quotation here / of folder (")moulin rouge" /

I did the paste reference, so the path is correct, what am I missing?
the other commands are correct as well now..

tell application "DVD Player"
activate
open VIDEO_TS of folder "Moulin Rouge" of folder "DVD" of startup disk
set viewer full screen to true
play dvd
end tell
quit
 
Ok, I think I see what's happening here. Try this:
open VIDEO_TS "Moulin Rouge" of folder "DVD" of startup disk

If VIDEO_TS isn't actually part of the file specification, it's type of file. For example, if you wanted to reference a file you'd say:
file "filename" of folder "foldername" of startup disk
or if you wanted to reference a folder you'd say:
folder "foldername" of startup disk

Let me know if it works/doesn't work.
 
wow... I got something new now..
first of all, just so you know, VIDEO_TS is a folder.. it is where all the DVD files are stored.. ( if you look at the dir-structure of a DVD, there is a VIDEO_TS folder at the top. so that is what needs to be referenced..

but get this.. I just did the copy-reference thingy, and it gave a new syntax that I haven't seen..

tell application "DVD Player"
activate
open VIDEO_TS «class cfol» "Moulin Rouge" of «class cfol» "DVD" of «class sdsk»
set viewer full screen to true
play dvd
end tell
quit

?? now, the applescript accept this as a correct syntax now.. so the script seems to be good to go BUT it wont' run, when I run it i get a

Can't get «class cfol» "DVD" of «class sdsk».

for some reason it can't see DVD folder?? hmmmmmmmm
 
Ah, yep, those <<class cfol>> things are appleevent tags. Basically, those are what AppleScript actually changes your script references into before passing them to the player. I'm not sure why they show up in the script from time to time, but don't worry about them.

I'm not sure what the trouble is now. Try this:
Create a new script. Open your DVD player.
In Script Editor, click the Record button.
Go to the player, and try to play the DVD using your normal method. (I dunno, File>Open or whatever)
Stop the DVD, then go back to Script Editor and click stop.

Have a look at what's in the script window now - if there's anything there. That might (if the DVD player's recordable) give you an idea of how to do it.

If that doesn't work, try changing your file reference to the following (I'm just guessing here)
open VIDEO_TS "VIDEO_TS" of folder "Moulin Rouge" of folder "DVD" of startup disk
or
open folder "VIDEO_TS" of folder "Moulin Rouge" of folder "DVD" of startup disk
or
open file "VIDEO_TS" of folder "Moulin Rouge" of folder "DVD" of startup disk
or even just
open "VIDEO_TS" of folder "Moulin Rouge" of folder "DVD" of startup disk

I'm not sure which (if any) of these will work.
 
grrr.. this last little thing is driving me nutz..

first of all, when I paste reference now, it is back to "of folder" stuff.. BUT the script editor always gives me a syntax error on that paste setup.. so I have to use the <<class cfol>> things, and then it accepts the syntax.. ( and I have no idea how to have paste reference to do them again.. I just manually put them in.. )

and I checked all the other commands of the script separately, they run great. BUT When the script runs, VIDEO_TS -- the script just doesn't seem to see the DVD folder on the Startup disc.. ( there is only one Hard Drive on this mac.. the dir-structure is really simple.. ) don't know why it chokes... it just gives me a

Can't get folder "DVD" of startup disk.

I tried both options above. no go.. the record doesn't show the path and I have been trying dozens of different syntax-paths..

I am still trying to figure out the silly little path thing..
-- geez I am sure it is something simple..
 
i finally got this to work ( someone helped me )
this is the final script ( coolness ) my first simple script ( yeay! )

tell application "DVD Player"
activate
open VIDEO_TS alias "BobsHDrive:DVD:Moulin Rouge:VIDEO_TS:"
set viewer full screen to true
play dvd
end tell
tell application "Finder"
close windows
end tell
quit
 
Congratulations!

Now if you wanted to make it even fancier... Rather than using a different script for each DVD you could have it display a list of the movies and let you select which one you want to play.

Have a look in the dictionary for "standard additions" about "choose from list". A list could be like this:
{"Moulin Rouge", "other DVD", "etc"}
I'll let you figure out how to do that if you want...
 
well, I am one step ahead of you :D

ok, so the script is a App. so it is a icon that I click to launch it right?? all I do is name the script what movie it is..
ex: "Star Wars Episode 1"

and here is the cool part.. I use Icongrapher to make a Icon that is the DVD cover art.. ( I just got to amazon.com, get the picture of the DVD cover art and make it a icon..) takes like 2-3 minutes

so the DVD script is a cool icon of the DVD..
AND with OSX finder, I have AWESOME huge icons, so I just have a Window with HUGE icons ( that look awesome) and I can scroll though my DVD movies that I have.. )

check the screen shot -- VERY cool eh??
( NO I don't have any of these DVD's on Hard drive yet. this is a test to see If I liked the idea.. I think it is very cool.. plan to put it into action one day in the near future.. )
 

Attachments

  • dvd.jpg
    dvd.jpg
    62.5 KB · Views: 9
Back
Top