You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Batch Change Title to Capture Date-Description-Padded Sequential Number

Last modified: Jul 1, 2018 10:39 AM
7 10912 Last modified Jul 1, 2018 10:39 AM

The following is primarily the work product of Léonie. She provided the script which I modified to meet my specific requirements.


It's an application what will batch change the title of selected photos to the following format:


EXIF Capture Date (System's Short Date)–Description–Padded Sequential Number


The script is:

on run {input, parameters}


-- batch change the title to the input, © léonie, version 1.0.1


set n_digits to 2 -- how many digits for the appended number

set answer to display dialog "Select the number of digits for the appended numbers (0 .. 10). Selecting '0' will suppress the leading zeros." buttons {"o.k"} default answer n_digits


set n_digits_text to the (text returned of answer)

set n_digits to n_digits_text as number


tell application "Photos"


activate

set counter to 1

set imageSel to (get selection) -- get selected images

if imageSel is {} then

error "Please select some images."

else

repeat with next_image in imageSel


-- the counter with padded numbers

set ntext to the counter as text

repeat while (the length of ntext < n_digits) -- add leading zeros

set ntext to "0" & ntext

end repeat



-- retrive the date

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 & "-" & input & "-" & ntext as text


tell next_image

set the name to new_title as text

set counter to counter + 1

end tell

end repeat


-- return new_title

end if

end tell

return input

end run


The Automator app window looks like this:

User uploaded file

When run the first window that appears, to enter the description, is:

User uploaded file


The next window, to set the number of digits in the sequential number, is:

User uploaded file

This results in:

User uploaded file


The date is expressed by the System's Short date as setup in the System/Language & Region/Advanced/Dates preference pane:

User uploaded file


I preferred to go with the Year-Month-Day format as it sorts better in the Finder. The default in the US is Month-Day-Year.


The Script menu was activated via the Applescript Editor General preference pane

User uploaded file


so that the app is easily available from all windows:

User uploaded file


NOTE: for scanned images the date used will the the file creation date which the Finder users and applies to new files.


A copy of the app can be downloaded from P01 - Applescripts from Photos’ User Tips Compiled as Applications.


Again, thanks to léonie for most of the input for this app.

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