Blog

From the “Wish we'd thought of this” file…

Posted by Brian on 02.06.09 @ 6:43 AM File Under: OmniGraffle

One of the best aspects of doing the work that we do is getting to see the really cool stuff that customers do with the tools we make. One such nugget of awesome came to us last Friday, when we got an email with this AppleScript as an attachment:

faces-v3

[Update: If you downloaded an earlier version of the script and it didn't work, try the updated one above. It handles the '~' in the iPhoto library preference now, and it avoids a problem that folks using a document style with no line head specified would encounter.]

The script makes use of the new Faces feature of iPhoto '09. It looks for named faces in your library, then creates an OmniGraffle document showing which ones appear in photos together. At that point, it fires off OmniGraffle's automatic layout feature. I'll let the script's author, Armin Briegel, describe the results:

“It probably depends on your picture taking habits, but in my graph you can pick out families and groups of people, such as my son's classmates. The big mess in the middle is obviously our closest friends and families. But even there the families are in close proximity to each other.”

In any case, this gets our robot-stamp of approval, so we thought other folks might want to check it out, as well. Enjoy!

 

  1. Ian

    02.13.09 5:35 AM

    Not working for me - “unable to open ~/Pictures/iPhoto Library/face.db”: unable to open database file.  File is definitely there, iPhoto not running. Shame - am interested in this.

  2. Armin Briegel

    02.13.09 6:41 AM

    Since sending this script to Omni I found that it breaks on some installations. To fix this in the script replace the first two lines after the “on run” handler with this:


    set iPhotoLibPath to do shell script “defaults read com.apple.iPhoto RootDirectory”

    —expand the '~' if it's in there

    set faceDBPath to do shell script “echo ” & iPhotoLibPath

    set faceDBPath to quoted form of (faceDBPath & “/face.db”)


    to make it work on all iPhoto installations.

  3. David Shepherdson

    02.13.09 9:44 AM

    Unfortunately the script doesn't work for me—looks like there's a problem expanding '~' in my iPhoto Library path when it's contained in quotes (as the script does), and hence sqlite gives an error about not being able to open the database.


    Changing the script so that it replaces the tilde in the path with the full path to my home directory (e.g. defaults read com.apple.iPhoto RootDirectory | sed -e 's:~:'$HOME':g') will do the trick.

  4. Tim

    02.13.09 4:20 PM

    I've updated the script above; though I did it before I noticed Armin's shorter fix, sadly =)

  5. Ian

    02.13.09 5:31 PM

    All working for me now - thanks for the fix, nice thing to have.

  6. Kevin Ballard

    02.13.09 8:49 PM

    When trying to run the script, OmniGraffle ends up shutting down (without a crash notice, just it's gone) and I get an AS error saying it lost connection to OmniGraffle.

  7. Arnþór Snær

    02.13.09 10:57 PM

    I tried v1 and v2 but after graphing two of my contacts, the script serves the following error: “Can’t set head type of graphic id 6 of canvas id 1 of document “Untitled 3” to head type of graphic id 6 of canvas id 1 of document “Untitled 3”.”


    Any ideas?

  8. Seth

    02.13.09 11:33 PM

    Fantastic. Thanks.

  9. Ken

    02.14.09 1:13 AM

    OmniGraffle Professional 5 got an error: Can’t set head type of graphic id 5 of canvas id 1 of document “Untitled” to head type of graphic id 5 of canvas id 1 of document “Untitled”.

  10. Tim

    02.14.09 2:25 AM

    Any messages in /Applications/Utilities/Console.app?

  11. Stonewall Ballard

    02.14.09 3:11 AM

    V2 fails for me on line 72: “set tail type of theline to head type of theline”. It looks like head type and tail type aren't really there. Commenting out that line makes the script work. This is in OmniGraffle Pro 5.1.1.

  12. Patrick

    02.15.09 5:20 AM

    Hi,


    I just tried to use the script but get this error:


    “„OmniGraffle Professional 5“ hat einen Fehler erhalten: „head type of graphic id 24 of canvas id 1 of document “Ohne Titel”“ kann nicht als „head type of graphic id 24 of canvas id 1 of document “Ohne Titel”“ gesetzt werden.”


    Hopefully this can easily be fixed.

    Thanks in advance

     

  13. Arnþór Snær

    02.15.09 5:28 PM

    No messages appear in console.app.

  14. Brian

    02.15.09 6:58 PM

    It looks like the script gets unhappy if you've chosen a line style that doesn't have a head shape attached. If folks open a new “basic” diagram using the Template Chooser, the script will run just fine, though.


    I'll poke at the script a bit.

  15. Brian

    02.15.09 7:14 PM

    New version of the script uploaded; it now explicitly sets the line head and tail to the “FilledArrow” type.

  16. Jorge

    02.16.09 8:56 PM

    In my case it runs for a while and then I get “AppleScript Error: OmniGraffle Professional 5 got an error: AppleEvent handler failed.”.


    On the console there are several messages:


    2/17/09 12:57:56 PM [0x0-0x63063].com.omnigroup.OmniGrafflePro[5551] forwarding exception, port = 0x0, behaviour = 0, flavor = 0

    2/17/09 12:57:56 PM [0x0-0x63063].com.omnigroup.OmniGrafflePro[5551] forward_exception got unknown behavior

    2/17/09 12:57:56 PM com.apple.launchd[75] ([0x0-0x63063].com.omnigroup.OmniGrafflePro[5551]) Exited with exit code: 1

    2/17/09 12:57:57 PM OmniGraffle Professional[6554] OSULastRunStartInterval default is non-nil; unless you forcibly killed the app and restarted it it should be nil at launch time.

    2/17/09 12:57:58 PM OmniGraffle Professional[6554] *** -[OZZuul page]: unrecognized selector sent to instance 0x1320f530

    2/17/09 12:57:58 PM OmniGraffle Professional[6554] An exception was thrown during execution of an NSScriptCommand…

    2/17/09 12:57:58 PM OmniGraffle Professional[6554] An exception was thrown during execution of an NSScriptCommand…

    2/17/09 12:57:58 PM OmniGraffle Professional[6554] *** -[OZZuul page]: unrecognized selector sent to instance 0x1320f530


    I hope this helps.

  17. [...] it takes what it’s found and spits out an OmniGraffle document showing which people appear in photos together. The result is this weird spidery [...]

  18. Aaron

    02.20.09 9:24 AM

    I've got the same problem as Jorge:


    2/20/09 4:27:30 PM OmniGraffle Professional[12326] *** -[OZZuul page]: unrecognized selector sent to instance 0x8f3f90

  19. [...] of iPhoto from iLife ‘09 and a version of the OmniGraffle diagramming software, you can now run a script (submitted by a customer) that takes iPhoto’s Faces database and creates an OmniGraffle [...]

  20. [...] of iPhoto from iLife ‘09 and a version of the OmniGraffle diagramming software, you can now run a script (submitted by a customer) that takes iPhoto’s Faces database and creates an OmniGraffle [...]

Commenting is not available in this section entry.