2 Replies Latest reply: Jan 5, 2011 4:46 PM by Pierre L.
Marion T Level 1 (5 points)
is it possible to auto-create smart albums from all my keywords?

I know how to do it manually, but, as I have many keywords, I would like it done en masse.

iMac, Mac OS X (10.5.5)
  • Pierre L. Level 5 (4,255 points)
    Oops… not yet!
  • Pierre L. Level 5 (4,255 points)
    If you don't mind using [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html], maybe you might like to try the following script. However, you must first enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.

    *tell application "iPhoto"*
    *   set allTheKeywords to {}*
    *   repeat with thisPhoto in photos*
    *      repeat with thisKeyword in keywords of thisPhoto*
    *         if name of thisKeyword is not in allTheKeywords then*
    *            copy name of thisKeyword to the end of allTheKeywords*
    *         end if*
    *      end repeat*
    *   end repeat*
    *   repeat with thisKeyword in allTheKeywords*
    *      if not (album thisKeyword exists) then*
    *         tell application "System Events" to tell process "iPhoto"*
    *            keystroke "n" using {option down, command down}* -- New Smart Album…
    *            keystroke thisKeyword* -- Smart Album name
    *            tell group 1 of sheet 1 of window 1*
    *               click pop up button 1*
    *               keystroke "Keyword" & return*
    *               click pop up button 1 of group 2*
    *               keystroke "is" & return*
    *               click pop up button 1 of group 1*
    *               keystroke thisKeyword & return*
    *               keystroke return* -- OK
    *            end tell*
    *         end tell*
    *      end if*
    *   end repeat*
    *end tell*

    The above script seems to work flawlessly with a few keywords. I can't say if it will work properly with many keywords.

    Hope it can help.

    Message was edited by: Pierre L.