Photos for Mac 5.0 (Catalina) has broken photo imports, specifically it has chosen to change the filenames to ALL CAPS.
I have a custom script I’ve written that works within Photos, taking an imported photo with a filename like this:
19690716183000 Our Apollo 11 party.jpg
extracting the date and time from the first part, and then putting the title into the Title field in Photos. With this new version, unfortunately, the title from the imported photo now reads “OUR APOLLO 11 PARTY”.
My first solution was to force the title to Sentence case - which results in “Our apollo 11 party”, but then I have to manually go through and fix all of the titles that should have caps in them.
I considered this - while working on a photo from within Photos, find the source picture in the import folder, grab the title from there, and put that in the Title field of Photos.
Where I am having problems is with getting a proper path to the file so I can grab that non-caps photo title.
Here is a fragment of my code:
set inputFolder to "Thorin:users:a2history:Desktop:Import:"
repeat with i from 1 to count of imageSel
set thePhoto to item i of imageSel
-- Format of date in title is:
-- "20070810140512 Title"
-- which means August 10, 2007, 2:05:12 pm
-- get filename of photo from within Photos
set aTitle to filename of thePhoto
-- at this point, aTitle = "19550601120000 MIDLAND COLLEGE LIFETIME ATHLETIC PASS.JPG"
set fullPath to inputFolder & aTitle
display dialog fullPath as text
-- this displays "Thorin:users:a2history:Desktop:Import:19550601120000 MIDLAND COLLEGE LIFETIME ATHLETIC PASS.JPG"
set bTitle to name of (info for fullPath)
set aPosix to quoted form of POSIX path of fullPath
display dialog "bTitle='" & bTitle & "'" & return & "aPOSIX='" & aPosix & "'"
The first display dialog does execute, and shows the text listed in the code above.
The last display dialog never executes; instead, I see this error message:
FILE
Thorin:users:a2history:Desktop:Import:19550601120000 MIDLAND COLLEGE LIFETIME ATHLETIC PASS.JPG wasn’t found.
Finder got an error: File Thorin:users:a2history:Desktop:Import:19550601120000 MIDLAND COLLEGE LIFETIME ATHLETIC PASS.JPG wasn’t found. (-43)
What I want to do is get the original name of the file in the Import folder, the version that has not been capitalized. In this example the filename is “19550601120000 Midland College lifetime athletic pass.jpg”. I can use this to extract the correct photo title and put that info into the Title field in Photos.
Suggestions? Thanks in advance!