Script: Batch Changing the Title to the Capture Date

by: 
Last modified: Jun 13, 2016 7:16 AM
7 9412 Last modified Jun 13, 2016 7:16 AM

If you want to be able to display the date below the thumbnails of your photos, consider to batch change the titles to the capture date using an Apple Script.


This simple script will read the dates from selected photos and set the title of the photo to the date string. Open the Script Editor and paste this in:

(* Batch change the titles of the selected photos to the capture time


How to use this script:

- Select all photos you want to change the title of in Photos

- Open this script and run it by pressing the "Run" button in the toolbar.

- The script will read the capture date from the selected images and create a short date string according to the system preferences for the short date format in System Preferences > Language & Region > Advanced

- The script will return the last date of the last photo it changed


- if you save this script as an Application you can add it to the Dock and run it from there


This script has been tested in Photos version 1.0, with MacOS X 10.10.3


© Léonie

*)


(* 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


Then select the photos from your most recent import in Photos and click the "Run" button in the toolbar of Script Editor.


The script should look like this in the Script Editor:

User uploaded file

It will format the date like in the short date format set in System Preferences > Language & Region > Advanced.

A copy of the script is here in my Dropbox: https://www.dropbox.com/s/zdrrjiq62g8bsf7/PhotosDate2Title.scpt?dl=0

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.