Set iPhoto Titles

This sets the titles of photos imported into an library based on a set of text files in a given directory:

tell application "iPhoto"
  set bound to count of (photos in current album)
  log bound
  repeat with i from 1 to bound
    set oldname to (name of photo i of current album) as string
    try
      set mytitle to do shell script "cat /Users/user/Desktop/Import/" & oldname & ".txt"
      set the title of photo i of current album to mytitle
      log mytitle
    on error
      log oldname
    end try
  end repeat
end tell