Copy Photo Caption to Title with Applescript

Hi! Just moved to Photos/iCloud, having finally decided to invest in a 2TB monthly subscription. Most of my photos are ex Picasa, and the description of the photos are read by Photos as Caption. Is there a way I can use Apple Script to copy that Caption and write it to Title, thus displaying them for ready reference (vs using the Info box).


Any suggestions would be much appreciated.


BR,

AK

MacBook Pro 13″, macOS 10.14

Posted on Dec 24, 2020 10:02 AM

Reply
5 replies

Jan 3, 2021 9:32 PM in response to ak2k

Here is what I was looking for:


var photos = Application("Photos").selection()

this.console.log(`Changing ${photos.length} photos!`)

var count=0

for (const photo of photos) {

let datename = photo.date().toISOString().replace("T","_").replace(/:/g,"-").replace(/\..+/,"")

photo.name = photo.description() ? datename.substring(0,10) + " - " + photo.description() : datename

count++

console.log(`Renaming ${count} of ${photos.length}, new name ${photo.name()}`)

}

console.log(1)


Dec 27, 2020 11:02 PM in response to TonyCollinet

First of all, thank you. This is very helpful. Unfortunately I don't know Apple Script to modify to what I am looking to do, which is:


  1. For a given photo with a default title (e.g. IMG_5327.jpg)
  2. Extract the Caption EXIF data (<Command+I> when I have a given photo selected "Enter a Caption" is the default)
  3. Replace the existing title with that information
  4. If the Caption field is empty, replace Title with YYYY-MM-DD_HH-MM-SS"
  5. Keep extension as appropriate (e..g JPG)


I'd be really interested if something like this was possible and most grateful if it's possible to share something that's a bit more rudimentary for a novice like me to follow.



A

Dec 28, 2020 5:31 AM in response to TonyCollinet

Sure! Attached are two screenshots with photos from day before yesterday.


  1. Photo of menu - with the Info panel open. No caption (https://www.dropbox.com/s/wupit8nkencx952/Photo%201.pdf?dl=0)
  2. Photo of of rain in Singapore - with the info panel open and caption "raining at the zoo" (https://www.dropbox.com/s/uc47u1bviw207zy/Photo%202.pdf?dl=0)



What I'd like to do is run a script that will change the title of the photo from IMG_5301.jpg to "Raining at the zoo" ... and if there is no caption (e..g Photo 1.pdf), then I'd like the file to be 2020-12-26_15-03-38.jpg (let's pretend that the YYY-MM-DD and time when the photo was taken.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Copy Photo Caption to Title with Applescript

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