iPhoto Batch Apply Adjustments Using AppleScript

Here is an AppleScript for iPhoto that uses UI scripting to apply the same photo adjustments to an entire album of photos. This is very useful when you have a lot of photos from the same session that need the exact same adjustments.

How To Use

  1. In iPhoto, place all the photos you want edited in an album.
  2. Edit a photo how you want it and choose Edit > Copy Adjustments…
  3. Revert to Original the file you just edited or remove it from the album so it doesn't get edited again by the script.
  4. Select the album in iPhoto and run the script below in AppleScript Editor.
tell application "iPhoto"
    activate

    set numPhotos to count of photos in current album

    tell application "System Events"
        tell process "iPhoto"

            keystroke "a" using {command down, shift down} -- Select None
            keystroke "e" using {command down} -- Enter Edit Mode

            delay 1

            repeat until numPhotos is 0
                set t to value of static text 1 of group 4 of window 1

                keystroke "v" using {command down, option down} -- Paste Adjustments
                delay 1
                if numPhotos > 1 then
                    keystroke (ASCII character 29) -- right arrow

                    -- Wait for the next photo to load
                    set t1 to t
                    repeat until t1 is not t
                        try
                            set t1 to value of static text 1 of group 4 of window 1
                            delay 1

                        on error errMsg
                            delay 5
                        end try
                    end repeat
                else
                    keystroke return
                end if

                set numPhotos to (numPhotos - 1)
            end repeat
        end tell
    end tell
end tell

on delay duration
    do shell script "/bin/sleep " & duration
end delay


How It Works

It enters Edit Mode in iPhoto and performs Edit > Paste Adjustments… on each photo. On the last photo, it exits Edit Mode by pressing return. With UI scripting, you often need to use delays for the UI to "catch up" with the script. It really depends of the speed of the computer, so adjust them as necessary.

Question or Comment?