-- Convert YYMMDD_N titled photos to YYMMDD_0N, so that
-- they sort properly.
tell application "iPhoto"
set the_photos to selection
repeat with the_photo in the_photos
tell the_photo
set the_title to title
if length of the_title is 8 then
if character 7 of the_title is "_" then
set the_title to (characters 1 thru 7 of the_title & "0" & character 8 of the_title) as text
log the_title
end if
end if
end tell
end repeat
end tell