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.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Where are photo file names?

I've "titled" many, many photos in iPhoto by changing the filename (e.g. "DSC_2254" --> "On vacation in Hawaii"), but there appears to be no option in Photos to show the filename. So none of my "titles" appear. Am I missing something?

iMac (Retina 5K, 27-inch, Late 2014), OS X Yosemite (10.10.3)

Posted on Apr 9, 2015 7:56 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 11, 2015 5:41 PM

That is an idea.


I experimented a bit, and with Apple Script we could make it a bit simpler, directly in Photos: This will save the installation of exiftool and the necessity to export the files. This way the lossless workflow will be preserved.


Create an Automator action, that executes an Apple Script to change the titles to the filename, if the title is empty:


The Apple Script:


on run {input, parameters}

tell application "Photos"

activate

set imageSel to (get selection)

if imageSel is {} then

error "Please select an image."

else

repeat with im in imageSel

set title to the name of im

if not (exists (title)) then

set the name of im to the filename of im

end if

end repeat

end if

end tell

return input

end run

Launch Automator, create a new service, and drag a "Run Apple Script" action into the workflow.

Copy and paste the text above into the "Run Apple Script" action to replace the default text in the action.

User uploaded file

Save this workflow with a suitable name. It will be installed in the services.


  • Now launch Photos and select a few test images.
  • Open the "Photos Menu > Services".
  • The service should be shown in the menu - I saved my version as "filename2title".
  • Select the service to let it run. When you click the selected photos again, the titles should change.


User uploaded file

After the Automator action completed:

User uploaded file



282 replies

May 4, 2015 2:28 PM in response to turingtest2

turingtest2 wrote:

It seems that in principle display dialog should be causing the same kind of error, or at least it would have done in days gone by. I can't see why that can be handled without triggering an error but offset does.

Nor can I. I'm still puzzling over the OS X Automation article statement that "scripting addition commands are not available by default." That implies that a use scripting additions statement should always be necessary to use anything in the StandardAdditions suites, including display dialog, offset, delay, & many other commonly used commands. But I know that most do not; in fact so far it is only offset that I have noticed the strange error & automatically generated tell current application behavior with.


I get it that if the script has any other use statement (like use application "whatever" or use script "whatever") then you have to include a use scripting additions one, but that isn't true for your script or any of the ones I have experimented with.


Something else that is puzzling is the upper/lower case issue that OT mentioned. I assumed I would have to add "JPG" to the list for your script to properly handle some of my Photos files with that capitalized version of the extension, but it did not seem to be necessary, nor was there any difference with or without it in the exclude list. This sort of jibes with something I read about the considering & ignoring statements in Apple's docs (that ignoring case is the default behavior) but I'm not sure why it (apparently?) makes a difference for OT's files & not mine.


Speaking of which, I'm not sure the whole offset into a string method is a bulletproof way of uniquely identifying extensions. I haven't checks (nor do I know if it would ever come up in this context) but consider what might happen if the extension was something like .cr2 & there also was a .cr2a one. The first does have a non-zero offset into the second, so could that be problematic in some scenarios?


In the past, & for a different use, I have handled this by using a list of strings instead of a single string with all of them in it -- like set exclude_list to {"text 1", "text", "text 2", "whatever"} -- which I then test against with a simple "is in" statement. That probably is not necessary in this use ... but it does avoid the pesky offset command. 😝

May 4, 2015 3:12 PM in response to R C-R

I'd read up on case sensitivity too and both theory and practice (in my case) said I didn't need to worry about it, but perhaps it would be better if I made it explicit. As for substring searches I'd thought about it, but I've assumed until I know otherwise that there isn't a potential for a clash within the relatively limited set of valid image entensions. I've yet to explore more deeply but in my vbScripts I sometimes wrap the values with vertical bars, e.g. "|.jpg|.mov|.png|.tif|" and then add them to the search term. VBS doesn't have anything that looks as efficient if element is in list, on the other hand I've found that AppleScript doesn't seem to like some nested clauses which I would normally use to avoid having to declare variables to hold intermediate results. I shall find out what works and what doesn't. 🙂


tt2

May 4, 2015 4:16 PM in response to turingtest2

turingtest2 wrote:

VBS doesn't have anything that looks as efficient if element is in list, on the other hand I've found that AppleScript doesn't seem to like some nested clauses which I would normally use to avoid having to declare variables to hold intermediate results.

Handling lists seems to me to be one of Applescript's most powerful features, but I have admit I often find them hard to work with, particularly when lists of lists are involved.

May 4, 2015 4:24 PM in response to Old Toad

Old Toad wrote:

I noticed that the second line I've been working with is "Set to include" which keeps .cr2 in the title. I removed that line, keeping .cr2 in the line above, and got the following error message.

I assume you mean "set include to" & not "set to include" but since the include variable is used later in the script (in the if (offsetofextininclude) > 0 andnotext = postfixthen statement) the script will error out with that message whenever it tries to execute it.


That much I understand. The rest of it, not so much. 😟

May 5, 2015 6:10 PM in response to JaneTeis

JaneTeis wrote:

This is too complicated for me. I don't do any applescript or programming. Why can't Apple just let us show the FILENAME under each photo? I don't want to have to type some "Add a Title" to every photo.

Only Apple can say why Apple made the change but the reality is that filenames & titles are two very different things, & iPhoto (& thus Apple) never did users any favors by obscuring that difference.

May 13, 2015 2:46 PM in response to léonie

léonie - very cool what you've done here for us! I can use the script you've written to change the descriptions, and I can use the script you've written to change the titles to the file names. Both work great. However, they're just shy of what I want. Let's say I go to Germany for a vacation and on day one I go to Hamburg. I would like to batch change the titles to all say either Hamburg, or even better sequential titles of 01_Hamburg, 02_Hamburg.


I've tried modifying your script just to change the title to the input text but I must be messing up the syntax. Here's one version I've tried (that does nothing at all!)


on run {input, parameters}

tell application "Photos"

activate

set imageSel to (get selection)

if imageSel is {} then

error "Please select an image."

else

repeat with im in imageSel

set title to the name of im

if not (exists (title)) then

set the name of im to the filename of im

end if

end repeat

end if

end tell

end run


Appreciate any help you can give me finding my mistake. If you want to help me kick it across the goal line and add that index number too that would be swell!


thanks!

Allison Sheridan

NosillaCast Mac Podcast at http://podfeet.com

May 16, 2015 10:43 AM in response to Old Toad

When I run the Title script it queries me for what name I want and it queries for how many digits. However it sends a generic error to the screen and says, “want me to show you the workflow?”


There’s only 2 steps here - one is to get the images, two is to rename them, so I tried adding a speech thing in between the two steps to see where it was failing and it does do the speech. I tried looking at the details as the script ran and all it does is give me a red x error, with no details.

I feel like one of those people who simply write back, "it didn't work" but I can't figure out how to diagnose this. Note that the change description script DOES run properly.

?

May 16, 2015 10:05 PM in response to Old Toad

Old Toad - downloaded from the user tip.


Jay Deitch - YOU GOT IT! I had selected Photos and it didn't run. Just selected All Photos and it DID run. Apple is driving me bonkers with their naming conventions lately.


thank you all so much! Especially léonie for writing the scripts. I think I'm going to have a gift to bring back to the thread. A friend of mine wrote a script for me that does something cool. I'm going to leave you with a tease for now because she's off on her boat in Alaska and I can't ask her permission yet to publicize it (but she'll say yes for sure!)


Happy dance,

Allison

May 17, 2015 12:30 PM in response to Jay Deitch

Which of the scripts are you using? File Name to Title, fFile Name to Title wo Extension, Batch Change Title With Padded Numbers or Batch Change Title With Date, Desc and Padded Numbers.


They all work in for me in albums in the sidebar. You might try launching Photos with the Command+Option keys held down and repair the library. Then try again.

Where are photo file names?

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