15 March 2011

Commenting multiple photos in iPhoto ’11

When the App Store for Mac came out, I was excited at the chance to buy iPhoto without paying for the other apps that I didn't need. My excitement quickly turned to remorse as I encountered bug after bug after bug. Additionally, iPhoto removed useful functionality like the ability to use command shortcuts to switch between photos in "View" mode: in iPhoto it is now impossible to add comments to a number of photos in succession without a lot of mousing around.

I wrote an Applescript to partially overcome this limitation. It takes the selection and gives a dialog box for commenting each one. If the selection is contiguous it will properly display the photos in full screen mode as you comment them.

Quickly comment the selected photos in iPhoto '11, viewing them in full screen if the selection is contiguous. Authored by Seth R Johnson, licensed under Simplified BSD.
tell application "iPhoto"
 -- this works best with contiguous photos
 set sel_photos to selection
 if number of sel_photos is 0 or (class of item 1 of sel_photos is not photo) then
  error "Please make sure photos are selected."
 end if
 -- press the space bar to make the photos full screen
 tell application "System Events" to keystroke " "
 repeat with this_photo in sel_photos
  tell this_photo
   set c to comment of this_photo
   display dialog "Enter the comment for photo '" & (title of this_photo) & "':" default answer c buttons {"Cancel", "Apply"} default button 2
   set new_comment to text returned of result
   if c is not new_comment then
    set the comment of this_photo to new_comment
   end if
  end tell
  -- Press the right arrow key to advance to the next photos in the album
  tell application "System Events" to keystroke (ASCII character 29)
 end repeat
end tell


Crick said...

Thanks! This was just the jump I needed to add/change a common comment across multiple images.

Post a Comment