Skip to content

Instantly share code, notes, and snippets.

@adizere
Created January 11, 2016 08:51
Show Gist options
  • Save adizere/997c28c417e1964d08e2 to your computer and use it in GitHub Desktop.
Save adizere/997c28c417e1964d08e2 to your computer and use it in GitHub Desktop.
AppleScript that modifies the title of photos to contain their respective date/time. Modifies the photos and videos in-place, directly in the Photos app. Execute with ScriptEditor.
(* select at least 1 image in Photos *)
tell application "Photos"
activate
set imageSel to (get selection)
if (imageSel is {}) then
error "Please select at least one image."
else
repeat with i from 1 to count of imageSel
set next_image to item i of imageSel
set capture_date to (the date of next_image)
set short_capture_date_string to the short date string of capture_date
set capture_time_string to the time string of capture_date
set new_title to short_capture_date_string & " @" & capture_time_string
tell next_image
set the name of next_image to the new_title as text
end tell
end repeat
end if
return "Adjusted the titles of " & (the length of imageSel) & " photos. The last date is " & ((the date of next_image) as date)
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment