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!

7 responses to “FileMaker, Automator and iLife”

  1. Luc Roels says:

    Hi Todd,
    Indeed a fun project!
    Just two small remarks:
    A typo In the script “Choose Music From iTunes ( Prompt )”, Set Variable $path should read “Middle (t; p; 10000)” instead of “Middle (t; 12; 10000)”.
    The AppleScript should be internationalized as in most of Europe the “;” is used as a list delimiter. This was probably left as an exercise for the reader ;-).
    Anyway, thanks for a showing another way of integrating different techniques with FileMaker.
    Luc

    • toddgeist says:

      Nice catch on the typo. 🙂 I didn’t know that Applescript used “;” as the delim in Europe. Thanks for pointing that out!

      • Luc Roels says:

        To be more precise: the semicolon is used as a list separator, especially in cases where the decimal separator is a comma, such as 0,32; 3,14; 4,50, instead of 0.32, 3.14, 4.50
        This would be the case for most countries on the european mainland.
        Luc

  2. Thanks for this Todd !

    iPhoto is also returning some Unicode values in the path.

    i.e. : “image:/Macintosh HD//Users/username/Pictures/iPhoto Library/Originals/2010/25-d\U00e9c.-10/DSCN0417.JPG”

    d\U00e9c standing for 25-déc.-10

  3. Todd Geist says:

    Hi!

    So this is probably also a language issue. Sorry, being a typical American, I think the whole word speaks English. I get very little exposure to these kinds of issues. I wouldn’t even know how to begin to fix it. I would guess that it has to do with the fact it is using an automator action that I created with an American English version of OSX. But I really don’t know

    But you could probably just use the technique I outlined in the demo but replace it with your own automator action. That should work just fine.

    Sorry I can’t be more help

    Todd

  4. Tdorges says:

    Hi,

    This looks really good but I am a filemaker novice and was wondering if you could help me incorporate it in my database. I just need the photo capacity really and have managed to get the document.wflow file but can’t get it in my database. Thanks for any advice you can give.

    • Todd Geist says:

      Hello,

      Sorry for this late response…

      If you look at the example file you will see that the wkflow file is stored in a container field. You need to create a similar container field in your database, and place it in there. You could also just import the entire table into your solution, using the File -> Import ->File menu.

      Hope that helps

      Todd

Leave a Reply