How to use KM to accept Photo's Faces name suggestion?

I’m having some trouble developing a Keyboard Maestro macro that accepts Photo’s top choice when naming a person in a photo.

In this situation, I have showing a picture’s information sheet (which appears when you select Command-I (for Information)), and click one of the Add Faces icons on it. Or sometimes, Photo has identified a face on its own. Often there are several faces in the picture to be named. In any case, a specialized circle appears on the photo, with a name field beneath it. That circle can be moved and its size adjusted to cover the face of a specific person in the picture.

You have to click in the name field to start typing in it. When you start to type in the name of the person, Photo looks for names from earlier entries that start with the letters you are typing and the suggestion list that appears shortens as you type more letters. Usually you start by typing the person’s first name. If you’ve done that for a person before, usually, but not always, the top listing of Photos’s suggestions is the correct person’s name. You can keep typing until you get the top one correct.

At any point, however, you can normally move your mouse pointer to click the suggestion you want in order to have that information transferred to the name field, and when you do that, the suggestion list disappears, and the full name is now fully spelled out in the name field, but still in editable form. To confirm that name in the field, which allows you to use the arrow keys to go the next picture, or to move the field selection to another circle/name-field combination, perhaps one where Photo has found a face and wants you to name it, you have to first press Tab or Return. It means you have to keep lifting your fingers on and off the keyboard to do that, and that thoroughly annoys me.

My current two-step macro, so far, simply uses a keyboard trigger to first issue a Move and Click from the Current Mouse Location instruction, followed by a Tab keystroke to confirm and either release the name field or go to the next name field available in the picture.

It took me a while to figure out where the click had to move to. I’m still unsure where the current Mouse location is that Keyboard Maestro finds to use as its calculation base for the move, because the mouse pointer disappears when you click the name field, and the name field could be almost anywhere on the photo. I’m assuming (and please correct me if I’m wrong) the mouse position is where I first clicked the name field and it stays there invisibly for KM to find after the pointer disappears as I start to type the person’s name.

After some trial and error, I finally got the click to occur offset from the current mouse location plus 22 pixels to the right and 22 pixels down. The macro usually, but not always, works in the way I expect it to do. Sometimes it fails to click the suggestion and just confirms the partial name as typed (because the Tab key tells Photo to confirm whatever’s typed there, often a partial name).

I don’t know why it doesn’t always click the suggestion list in the right place. I know that when you start typing the name, the name field expands from the field’s centre, and that it takes four or five characters worth of typing to most reliably (but still not entirely reliably) to click the correct suggestion, even if just typing one letter brings the correct name to the top of the suggestion list.

But even this only works in the ‘normal’ position of the suggestion list, where there is enough room for the suggestion list to drop downward. However, if the name field is close to the bottom of the photo, the suggestion list goes upward to give the list room for al the suggestions, and there’s no way I can figure out how to get KM to figure out where to click in that situation, and there’s also no way of telling how many suggestions will be offered, and that means the location of the ‘first’ suggestion could be anywhere vertically from the name field.

Any suggestions the forum members can offer to make this macro work more reliably in the normal situation, and separately in the upward situation, would be most appreciated. Thanks.

Hm, this works also without mouse here. When the name list appears I can simply go to the suggested name with the Arrow Down key, then I hit Return (the name gets transferred to the text field) and then Return again to confirm. Then I can move on with the Right Arrow key to the next circle or photo.

This is on El Capitan. Maybe you have an older system and they have changed something.

Huh. Yes, I’m using El Capitan and it works fine. Never even occurred to me to try that. Ah, well, never mind then.

Some (a few) things work fine even without KM :sunny: