Batch Change the Title of selected Photos to the Caption (Description)

by: 
Last modified: Jan 3, 2021 3:20 AM
3 4572 Last modified Jan 3, 2021 3:20 AM

Some Apple Devices can show the caption (description) with a photo, for example iPhones and iPads with iOS 14/ iPadOS 14 or newer, but Photos for Mac is showing only the title below the thumbnails. This simple script will copy the description to the Title field, so we can see it displayed with the photo. Is to be used like this:

  • Select some photos in Photos, but only in All Photos or in an album at the top level of My Album, not in an album nested in a folder.
  • Then open the script in Script Editor and click the Run button ▶︎

Tt will now copy the descriptions of the selected photo to the title field, if a description exists. It will show the photo it is currently processing (so you will see a lot of flickering). if you do not want to see the flickering, comment out the line by prefixing it with --

spotlight im

I have only tested this script in Photos 6 on macOS 11 Big Sur.


(* This script copies the description of photos to the title field

  To run the script, select at least one photo in a top level album or in All Photos. 
  You can select and batch change several photos at once. 
  But do not select the photos in a smart album or an album inside a folder.
 This script is useful, if you are viewing your photos in applications, that can show the title below the thumbnail.
  Author: Léonie 2020
*)


set imageSel to {}
set separator to " - "


tell application "Photos"
	activate
	try
		set imageSel to (get selection)
	on error errTexttwo number errNumtwo
		display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo
	end try
	if imageSel is {} then
		error "Please select some images."
	else
		repeat with im in imageSel
			set newTitle to ""
			-- get the description of the image if it exists
			set newTitle to (the description of im) --as string
			
			set hasDescription to (newTitle is not equal to missing value) and (the length of newTitle > 0)
			
			
			
			if hasDescription then
				try
					
					tell im
						set its name to newTitle
					end tell
				on error errText number errNum
					display dialog "Error: " & errNum & return & errText & "Trying again"
					try
						delay 2
						tell im
							set its name to newTitle
						end tell
					on error errTexttwo number errNumtwo
						display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo
					end try
				end try
				spotlight im
			end if
		end repeat
	end if
end tell
-- display dialog "Done"
return newTitle


if you need to do the opposite - write your titles to the descriptions, so you can see them on an iPd of iPhone, use this script: Script: Batch Change the Description to the Title plus the Current Description (Caption)


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