The titles iPhoto chooses for just-added photos is the annoying "IMG_nnnn" serial number from the camera. This AppleScript simply takes the date of the photo (EXIF info that iPhoto knows very well) and uses it as the photo title. The format is: yyyy-mm-dd-hh.mm.ss, so it's a bit easier to read than the ISO version, but also easily sortable.
Here's the code:
tell application "iPhoto"
-- activate -- bring iPhoto back to front
copy (my selected_images()) to these_images
if these_images is {} then error "Please select some images before using this script."
set thename to ""
set thepaths to ""
set thedates to ""
repeat with i from 1 to the count of these_images
set this_image to item i of these_images
--set this_file to the image path of this_image
set thename to thename & ", " & the title of this_image
--set thepaths to thepaths & the image path of this_image & ", "
set thedate to the date of this_image
set theyear to the year of thedate
set themonth to my format(the month of thedate as number)
set theday to my format(the day of thedate)
set theseconds to my format(the seconds of thedate)
set themins to my format(the minutes of thedate)
set thehours to my format(the hours of thedate)
set thetitle to theyear & "-" & themonth & "-" & ¬
theday & "-" & thehours & "." & themins & "." & theseconds
--set thedates to thedates & thetitle & ", "
set the title of the item i of these_images to thetitle as string
end repeat
end tell
on selected_images()
tell application "iPhoto"
try
set these_items to the selection
if the class of item 1 of these_items is album then error
return these_items
on error
return {}
end try
end tell
end selected_images
on format(thenumber)
if (thenumber as number) < 10 then
set res to "0" & (thenumber as string)
else
set res to thenumber as string
end if
return res
end format
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100307050736756