yeetboy

Q: Applescript to export single iPhoto album

I'm looking for a script that will allow me to export a single iPhoto album. I'd like to be able to automate it (eg. once daily). The name of the album never changes, but the content will.

 

I've found a few starting points, but nothing I've been able to wrap my head around. Most seem to require an actual input as opposed to a defined album.

 

Any help?

 

yeti

MacBook Pro (13-inch Mid 2012), OS X Mavericks (10.9)

Posted on Jan 8, 2014 8:20 PM

Close

Q: Applescript to export single iPhoto album

  • All replies
  • Helpful answers

  • by Camelot,Helpful

    Camelot Camelot Jan 8, 2014 9:07 PM in response to yeetboy
    Level 8 (47,243 points)
    Mac OS X
    Jan 8, 2014 9:07 PM in response to yeetboy

    It doesn't look like there's any direct AppleScript support for exporting an album, so you're down to UI scripting to do it.

     

    Given that your album choice is consistent you can just start off with:

     

    tell application "iPhoto"

              select album "My Super Awesome Album"

    end tell

     

    followed by the UI commands to export your album. Unfortunately I suck at UI scripting (i loath it) so can't provide much more context, but maybe you have the necessary incantations in your existing scripts.

  • by Pierre L.,Solvedanswer

    Pierre L. Pierre L. Jan 9, 2014 8:07 AM in response to yeetboy
    Level 5 (4,484 points)
    Jan 9, 2014 8:07 AM in response to yeetboy

    Depending of what you mean by “exporting an album”, the following script might do what you are asking for.

     

    set theDestinationFolder to POSIX file "/Users/user name/some folder" as alias

     

    tell application "iPhoto"

        set theImagePaths to image path of photos of album "My Super Awesome Album"

    end tell

     

    repeat with thisPath in theImagePaths

        set thisFile to POSIX file thisPath as alias

        tell application "Finder" to duplicate thisFile to theDestinationFolder with replacing

    end repeat

     

     

    Message was edited by: Pierre L. (no need to select the album)

  • by yeetboy,

    yeetboy yeetboy Jan 9, 2014 12:42 PM in response to Pierre L.
    Level 1 (0 points)
    Jan 9, 2014 12:42 PM in response to Pierre L.

    Fantastic, worked like a charm. Thanks.

  • by Pierre L.,

    Pierre L. Pierre L. Jan 9, 2014 2:21 PM in response to yeetboy
    Level 5 (4,484 points)
    Jan 9, 2014 2:21 PM in response to yeetboy

    My pleasure.

  • by ahasver65,

    ahasver65 ahasver65 Sep 14, 2015 1:24 AM in response to Pierre L.
    Level 1 (0 points)
    Sep 14, 2015 1:24 AM in response to Pierre L.

    Are you still replying one year in? Because I get the error

    "Can’t make file \"HD:Users:user name:Desktop:klasse\" into type alias." number -1700 from file "HD:Users:user name:Desktop:klasse" to alias

    Any idea? Thanks

  • by Pierre L.,

    Pierre L. Pierre L. Sep 14, 2015 4:12 AM in response to ahasver65
    Level 5 (4,484 points)
    Sep 14, 2015 4:12 AM in response to ahasver65

    Does the destination folder “klasse” already exist on the Desktop? It should.

  • by ahasver65,

    ahasver65 ahasver65 Sep 14, 2015 9:52 AM in response to Pierre L.
    Level 1 (0 points)
    Sep 14, 2015 9:52 AM in response to Pierre L.

    Actually I was stupid and it works indeed like a charm. Thanks a bunch. Forgot to put in my Username. Well that is very smart.