FileMaker, Automator and iLife

December 18, 2011 / By: Todd Geist

This started out as a fun R & D project on how to use Automator with FileMaker.  It turned out pretty cool. So I decided to wrap it up into a nice demo file.  You can use the code in this file to select movies, music and photos from iLife and stick them into FileMaker.

ARVE Error: need id and provider
 

Apologies, download file has gone missing.

Although you can select files of any type and insert them into FileMaker, using regular old FileMaker scripts, this gives you a nice clean easy way to control the process and it adds some features, like the ability to do multiple select. The cool factor comes from the interesting way that Automator is integrated.

You can call Automator Workflows from Applescript and you can run Applescript from FileMaker so this would seem like the obvious choice. But if you do that you will have install the Automator Workflow on every computer in a known location.  I decided to manage that process completed.  The Automator workflows themselves are stored in container fields and exported just before use. This way there is no requirement for something to be installed before the code runs.

But getting the Workflow package into a container field is no easy task; FileMaker sees it as Folder not a file, so it won’t accept it.  But inside the Workflow package is a single file that has all the magic.  Its called “document.wflow”.  That will fit into a container field.  But again there is a problem.  That file can’t be called by Applescript. Sad faces all around.

Luckily that file can be called via shell command and I can call a shell command with Applescript.  So yeah we have a solution. It goes like this.

  1. Export the document.wflow to the temp directory
  2. Execute an Applescript that does the following
    1. Run workflow with a shell command like this “automator -D <var>=<value> <path-to-workflow>”
    2. read the output
    3. clean it up
    4. pass it back to FileMaker
<var>=<value> stands for the any name value pair you need to pass into the Workflow.  These are available as Variables in the Workflow.

Thats it!

Talk to us

Recent Posts

RECEIVE THE OCCASIONAL UPDATE.

NEW PROJECT OR COLLABORATION?

Drop us a line at info@proofgeist.com, we’ll answer.

FOLLOW US.

© 2022 Proof+GEIST All Rights Reserved