My.ADVISOR.com Sign-In
Username
Password
Sign Up 
Go to Article
Advanced Search 

ADVISOR ANSWERS

Embed QuickTime Movies in a FileMaker Pro Database

Learn an alternative to the container field that lets you embed QuickTime movies in a database.

By Chris Moyer, The Moyer Group CEO and FileMaker Advisor technical editor, and Bob Bowers, Soliant Consulting CEO and FileMaker Advisor technical editor

UNLOCKED -- This article is provided to subscribers of FILEMAKER ADVISOR or DATABASED ADVISOR or FILEMAKER ADVISOR. To subscribe or renew, go to Advisor Store.

Q: I need to store some QuickTime movies in one of my databases and let users play them from FileMaker Pro. When I'm inserting the file, it doesn't look like I have the same options for choosing whether to embed the file in the database or store only a reference as I do with files and pictures. It only will store as a reference. That won't do, because I have to be able to send the database, with the movies embedded, to users, who are my company's employees. Do you have any ideas?

A: You're correct that the only option for inserting QuickTime movies into a container field is to store a reference to the actual file. If the file is moved, renamed, or deleted, you won't be able to play it.

A good way to sneak around this restriction is to embed the movies in the database as files (using the Insert File command rather than the Insert QuickTime command). As we'll demonstrate, you can then create a script that, on-the-fly, exports the file and re-imports it as a QuickTime movie. This approach should provide the user experience you're looking for.

Imagine you've embedded a file called Movie1.mov into a container field named myContainer. In its current state, users can't play the movie from the database. However, because it's embedded in the container field, it travels with the database when you send it to the employees.

Create a new field, moviePlayer, as a container field with global storage and place it on top of or near myContainer. Next, create a script that exports the file from myContainer and imports it back into moviePlayer (as a QuickTime movie).

The script ends up looking something like this:

Set Variable [$myOutputFile ; "file:" & Get (TemporaryPath) & "movieTemp.mov"]
Export Field Contents [myContainer ; "$myOuputFile"]
Set Variable [$myInputFile ; "movie:" & Get (TemporaryPath) & "movieTemp.mov"]
Go to Field ["moviePlayer"]
Insert QuickTime ["$myInputFile"]

The script begins by setting a local script variable, $myOutputFile, to a text string that represents the full file path, prefixed with "file:", which FileMaker Pro understands to denote a relative file reference. There's no need to create different paths for different platforms using the "filemac:" and "filewin:" formats; the generic reference works just fine. Notice the second part of the path string is the function Get (TemporaryPath). This function returns the full file path to a temporary directory FileMaker Pro maintains and has access to. You'll dump the file to this directory and point back to it with another container field.

In the second line, the script exports the contents of myContainer as a file called movieTemp.mov in the temporary folder. If necessary, you could also preserve the name of the original file simply by using GetAsText (myContainer) in place of the hard-coded movieTemp.mov.

Now that you have the file on the user's hard drive, it's time to import it back as a QuickTime movie. The format of a file reference for inserting a movie is slightly different than a regular file reference: instead of the "file:" prefix, movies must have a "movie:" prefix. (You can verify this detail by looking at the options in the Insert QuickTime script step.) Because of this requirement, the third line of the script creates another variable that references the exported file as a movie. With this in place, all that remains is to insert the movie into the moviePlayer field.

When this script finishes executing, the global container will contain a reference to the movie and the user can play it. The original container field still contains a "file" version of the movie. You've simply created a way to export the file in such a way that you know exactly where it is and what it's called. Remember this technique when working with container fields, because there are many variations that may come in handy for manipulating how or where you store objects.

What do YOU think about this topic? Share your advice and thoughts using this form.

Your Name

REQUIRED : PUBLIC

Your E-Mail

REQUIRED : PRIVATE

Job, Company

OPTIONAL : PUBLIC

City, State, Country

OPTIONAL : PUBLIC

Your Web Site

OPTIONAL : PUBLIC

Your Comment

Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

Chris MoyerChris Moyer is president and CEO of The Moyer Group, a FileMaker Pro consulting and training firm with offices in Atlanta, Chicago, and San Francisco. Chris is a technical editor of FileMaker Advisor Magazine.

Robert BowersBob Bowers is CEO of Soliant Consulting, and co-author of three books on FileMaker Pro, including Special Edition Using FileMaker Pro 7. Bob is one of a handful of trainers authorized to teach the FileMaker Professional Foundation Training Series. Bob has been a speaker at several FileMaker Developer Conferences, and was awarded the FileMaker Fellowship Award in 2002.

Printer-friendly
page layout

Keyword Tags: FileMaker, FileMaker Development, FileMaker FileMaker Pro

ADVISORAMA
If you look good and dress well, you don't need a purpose in life.

ARTICLE INFO

FileMaker Advisor

Web Edition: 2008 Week 14, Doc #19411

Print Edition: April/May 2008, Page 4

SUBSCRIBER ONLY ARTICLE LOCKED

Subscribe to FileMaker Advisor Magazine

Read the advanced guide to creating custom business database solutions with FileMaker software. Subscribe now to gain access to all the archives and downloads.

FileMaker.Advisor.com

Subscribe to Advisor Basics of FileMaker Pro

Learn the fundamentals of using FileMaker Pro software. Every issue gives you step-by-step instructions on creating the databases you need. Subscribe now!

FileMaker.AdvisorBasics.com

Secrets Of The Top Experts -- Now!

See exactly how to do it, step-by-step, in Advisor Academy CDs created by the top experts. Click to see what you can learn right now.

AdvisorAcademy.com

Free E-Newsletters

Keep up! Hot News, How-To, Tips & Tricks, Expert Advice, and more. Click to request your's free.

AdvisorUpdate.info

Need Know-How Now?

What direction are you going with your business? Advisor Guides are packed with the answers you need to work smarter. Can you afford to fall behind?

AdvisorStore.com

Showcase Your Smarts

Submit your tips, techniques and advice and let Advisor promote your business and build your career. Show the world what you know!

AdvisorTips.com

Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
Portions copyright ©1983-2008 Advisor Media, Inc. All Rights Reserved.
Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, Inc. in the United States and/or other countries.
Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
moyec074-01 posted 03/31/2008 modified 05/12/2008 03:43:46 AM ztfmfd/ztfmfd
domino-144.advisor.com my.advisor.com 05/16/2008 12:20:17 PM