Jump to content
Server Maintenance This Week. ×

Scripting to Play DVDs from Media Database


This topic is 5409 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I wonder if someone could point us in the right direction. We are novices at this.

I have an AppleScript to open DVDs from within our database of DVD folders (not DVDs) with their Video TS files. It works great! We wanted FileMaker to open a different DVD for each record (of course) but we realized that if we make this a button which activates this script below in layout mode, it always opens the same script.

How do we either:

1-set a variable so that a specific field can insert the name of the DVD file we want opened (this sounds hard, but it’s probably the right way)

or

2-enter a different script in each record the way you would enter a different picture.

Here is our AppleScript. It’s a bit quirky with two quit commands, but it worked better that way.

tell application "DVD Player"

stop

quit

quit

end tell

tell application "DVD Player"

activate

open dvd video folder alias "NAMEOFHARDDRIVE:NAMEOFDVDFOLDER:VIDEO_TS:"

set viewer full screen to false

set title to 1

set chapter to 1

play dvd

end tell

Thanks so very much if you can help!

Link to comment
Share on other sites

Yes, method 1 is better :D-)

1) First use ScriptMaker to create a new script called 'open DVD'. Add just one script step to this script: Perform AppleScript. Make 'Perform AppleScript' call exactly the same AppleScript that your button currently calls.

2) On your layout, change the button definition so that instead of calling the AppleScript, it does 'perform script' and runs the 'open DVD' script

3) Check that your button now does exactly what it used to do!

4) Then add another step to your ScriptMaker script, ABOVE the Perform AppleScript line. It should be:

Set Variable $AppleScript to ">"

Where I have written > you need to paste your AppleScript code again BUT you need to replace all the returns with the paragraph symbol (alt-7 on a mac) and you need to prefix every double-quote with a backslash

5) Then change the Perform AppleScript line so that instead of 'Native AppleScript' it does 'Calculated AppleScript'. The calculation in question should be simply $AppleScript

6) Check again that your button now does exactly what it used to do! If you get dodgy-looking AppleScript errors like -2741 or similar then you probably haven't done the returns and backslashes correctly.

Then you need to turn the variable in to a calculation, part of which will vary according to the record you are on... this is what will do the business. But I am tired and that is another job for another day, so do all the above and post again when it works. I have subscribed to this topic so will see when you reply!

Hope that helps

James

Link to comment
Share on other sites

Try performing a calculated AppleScript =


"tell application "DVD Player"¶stop¶quit¶quit¶end tell¶¶tell application "DVD Player"¶activate¶open dvd video folder alias "

&

Quote (YourField)

&

"¶set viewer full screen to false¶set title to 1¶set chapter to 1¶play dvd¶end tell¶"

where your field contains "NAMEOFHARDDRIVE:NAMEOFDVDFOLDER:VIDEO_TS:"

Link to comment
Share on other sites

Yes, that's what I was getting at. Much better explanation ;-)

My personal preference is to do it as a two-step script:

set variable $AppleScript to

perform AppleScript [$AppleScript]

The benefit of doing that is you can put debugger on and step past the "set variable" bit in the script, then use data viewer to copy the 'finished' script and paste it in to Script Editor from where it can more easily be debugged.

J

Link to comment
Share on other sites

This topic is 5409 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.