Add Name Texts To Each Photo in a Folder

This is a short summary of a macro I am trying to write. I have not started yet but will be starting today.

I am looking for just a outline of how to start.

  1. Display the photo's in a folder one at a time.
  2. Show a text box to allow me to enter the names of those in the photo.
  3. Show a pallet of all optional names.
  4. Select a name from the pallet and copy to text box.
  5. When done write all of the information in the text box to Comments section of the metadata of the photo and save the photo.

Thanks
Roger

Hey Roger,

Hope this helps a little bit, and I hope it's clear enough.
I don't know how to edit the metadata, but I'm sure someone will be able to help with that step.
Feel free to change the colors, edit/delete the comments, etc.

Edit Photo's Metadata Macro (v11.0.3)

Edit Photo's Metadata.kmmacros (32 KB)

In the section to pick the name(s) from the List of People variable, you can use CMD to pick 2 or more names, or use CMD to pick the first name and then SHIFT to select a list of people, if they are next to each other

1 Like

To edit the metadata, it seems that this is possible using a shell script.
VERY IMPORTANT NOTE: This was a solution offered by ChatGPT and I can't confirm that this works or not, as I'm no expert when it comes to shell. I will just put it here, just in case someone wants to just copy and paste it to then use as a starting point to share a working solution instead of typing the whole thing:

#!/bin/bash

# Define variables
FILE_PATH="/path/to/your/photo.jpg"
COMMENT="Your comment here"

# Use exiftool to set the comment
exiftool -Comment="$COMMENT" "$FILE_PATH"

ChatGPT comment: Make sure you have exiftool installed. You can install it via Homebrew (brew install exiftool ) if you don't have it already.


So if this is a working solution, we just need to change the FILE_PATH to match the path of the selected photo, and change COMMENT to match the value from the name(s) you picked (or added, if they are new). Since you have 2 options:
1 - Use a pre-saved name (or names)
2 - Add a new name (or names)
... we will need another IF THEN action or a SWITCH to then adjust the shell script

Thanks

I am trying to understand what you have given me so I have 2 questions.

I have 5 images in my photo directory.

  1. how dose this loop know to only get photos and not pdf or movie files? Maybe the Local__photo? If so where is this explained so I can read more about it?

  2. Since I have 5 photo's in my directory why dose the display only show 1 time. The loop works and puts all 5 of the images in to the file but only displays one time?

Thanks hope you don't mind helping me understand
Roger

Let me start by suggesting, if you haven't done this already, is that you have a folder where you perform all important tests, to avoid messing with real files.
Just create test folders inside that folder so you can test macros that others share with you, as well as your own macros, until you feel comfortable enough with certain actions and you know that they won't do anything wrong with your files.

This particular case doesn't filter out the files. I thought you had just photos inside that folder, so it would process all the files inside.
You have 2 options:
1 - Add another condition where it specifically picks certain extensions (jpg, gif, tiff, png, etc), so you will have to know which extensions to include
2 - You select all images prior to running the macro and then instead of the For Each action targeting all files inside the folder, you change the condition of the For Each. Instead of being "Folder Contents Collection", you use the "Finder's Selection Collection".

So this is the first step, because that will determine how the macro will change.
Let me know which method you want to use

In my case, it showed 5 times, since I have 5 files in a folder:
image

What do you mean when you mention "in to the file"?

Are you familiar with how the For Each action works?
https://wiki.keyboardmaestro.com/action/For_Each

I don't mind at all. We are all learning here and there, and I'm glad I can help other people. Usually it's me getting help with more complex things, so I'm happy to help you on your journey, just like others helped me :slight_smile:

If you want to use the version where it filters out the files by extension, you can add something like this:
image

Then you can add/delete extensions from the Regex section.
Not sure if you are familiar with Regex, but if you're not, I would suggest that you learn it as you will use it a lot with Keyboard Maestro. At least I do.
And then you can use the website https://regex101.com to test your regex.
Also, if you are not familiar, I would recommend these tutorials:
https://www.youtube.com/watch?v=r6I-Ahc0HB4

This guy kills it every time he creates tutorials. Such a great teacher. I learned the basics from him, took a lot of notes that I sometimes have to go back to, then learned new things from creating macros and from other members of the forum teaching me new things.

OK lets try one thing at a time so I don't get too confused.

I made 2 changes to your macro. I changed the location of the images and put a display text in a window.

I now have 6 images because I wanted to test to see if it selected just photo's or ?. The image I added was a .pdf

  1. The display only displays 1 time.
  2. When the macro completes the PDF is not shown in the preview only the jpg images.

Something seems wrong. I made sure I had the latest version of KBM but I am running Ventura 13.6.7

Thanks for your willingness to help me
Roger

Doesn't the Photos app already automatically detect the names of who is in each picture? Maybe a better approach is to see if someone knows how to extract those names out of the Photos app (or to add new names).

None of my images are in the Photo app. Some are from the early 1900.

Fair enough. I just like to try to find alternate solutions. I see someone else is working with a more traditional solution with you. I hope it works out.

I created a new macro for testing the for each.

Screenshot 2024-06-11 at 7.56.10 AM

The /Users/rogerwells/Desktop/AA - Photo Edit has 6 items. 5 are jpeg and 1 is a pdf

This macro displays the prompt for user input only 1 time.
It loads each of the jpeg items in the directory and opens them in Preview.
One of the items is a PDF it dose not get loaded to Preview

Keyboard Maestro Version 11.0.3
macOS Ventura 13.6.7

I must be doing something wrong but I can not figure it out?

Roger

Figured it out finally
/Users/rogerwells/Desktop/AA - Photo Edit

should be
/Users/rogerwells/Desktop/AA - Photo Edit/V2024

Finally
Roger