How can I "tell" KM where to click?

Hello.
Looking at my wife’s photos library I noticed she has lots of duplicates.
At the top of the screen there is a hyperlink to merge 1 set of dups.

The moment I confirm merging, another set is available.
I made a very simple macro that repeats the clicking on the hyperlink (“Merge x items”), confirms (types the “return” keystroke) and again the same Count times.

My problem is that the link “moves” and can be anywhere in a certain range, according to the date the pics/screenshots were taken. (E.G. “May 12 Merge 2 items” compared to September 14 & 24 Merge 2 items”.

Is there a way to “tell” KM where the link is, every time? (Preferable in “pure KM”, (no scripts) if it’s doable, because I have no knowledge in scripts).

Hopefully I made my question clear. (If not, I'm sure you'll let me know)... :joy:
TIA for any input.

Saul

Probably. I can't test my solution (below) for your specific situation because I don't use Photos very much. But you can simply use the Find Image action to search for an image of the word "Items" and move the mouse there and click the mouse. I do things like this all the time, because Find Image is good enough to even find "word images".

If you are getting a lot of these Merge warnings, you may want to take a step back and ask why you are getting them. For example, maybe you clicked on "Import All" instead of "Import New". It could be that changing how you do your work could remove this warning message entirely.

In any case, here's how I might solve this problem:

image

When I run the above image, it finds the word "Best" within its own action on the screen. See the screenshot below to prove that it "found its own text":

Hi Airy. Thanks for your reply!

It's not an error message/warning, it's just part of the process, to confirm that deleting the dups is what you really want to do.

I was thinking about the image direction (reading some posts here) but I had no idea how/where to start.
I'll try and update you.

Sorry, meant to but forgot to attach the macro.

Merge duplicates.kmmacros (7.3 KB)

Perhaps others can help without a screen shot of the macro with all its options visible, but I can't.

Sorry. I desperately need some more help. I am trying for the last several hours to understand how to work and implement in my macro the find an image action works.
I searched for the "find an image", "found image" and "foundimage token", read the Wiki, searched in the forum, even googled it, but all I found was above my ability to make it work (in one of the posts I tried, you (Airy) mention a macro you created: "ClickOnWord". Tried to find it but to no avail.
Could you please explain to me how can I integrate this/those actions so I make KM find and click on the "Merge x items" hyperlink?

I gave you a single action that would do the job of finding the location to click on. Here it is again:

All you have to do is create that action, and use an image of the word "Items" from your own screen. Did you try that? I can't load the correct image into the image well of that action because I don't have your screen.

If you do this, the location of the image will be stored in a variable called ImageOfText. Did you try this out and then check to see if that variable contained any data? Once you do this, you can then get a KM action to click on the screen at the location of that variable. Let me know if the variable contains the location of the word on the screen. The next step will be to use a KM action that will click on the screen at that location. I'll tell you how to do that if you try my advice above which will get you the location.

As I told you above, I can't use that screenshot to help you integrate my solutions with your macro. If you post an image of your macro (not the text version of it) then I can probably help you "integrate" with your existing code.

Hi @Saul - Photos can handle all your duplicates easily. Check out this discussion https://discussions.apple.com/thread/254320552?sortBy=rank.

So, you can easily clean up your duplicates by doing the following:

  1. Select all the duplicates by pressing A
  2. Click on the Merge xxx items button in the upper right corner
  3. Then follow the instructions given to you:
    image

image

Since it's a potentially destructive action, you might want to test it on a few groups of duplicates to start with.

Hi Airy.
Sorry, that's the image of the macro.
I will try doing what you explained and update.
Thanks A LOT!

Hi tiffle.
Thanks for the enlightenment!
I tried that before posting but missed the "merge xxx items" on the right (with red in your reply). (AND in addition, I thought "how come Apple don't come with an easier way!!!) :rofl:
Now I can do it really easy, but I will go on with my question in the forum because, although I have this easy solution, I would like to learn how to use the "Find image on screen" action.
Have a great day and thanks again!

1 Like

BTW, even risking to sound dumb (I can take that...) :blush:, what's the difference between the screenshot I posted first and the image I just posted?

You're better posting your macro images from "Edit" mode -- better yet with the disclosure triangles opened up so people can see the actions properly:

It grants a little more peace of mind to the people downloading your macro...

It's well explained on the wiki, but basically boils down to "give me, or do something at, the co-ordinates of this image". Main problems are getting the image into the well in the first place (use ⇧⌃⌘4 and drag out an area on your screen to copy that to the Clipboard, then click the action's Image Well and Paste), getting KM to look in the right place (eg "the front window", and picking the right image if there's more than one (eg "Topmost").

There are lot's of demo macro's on the Forum -- search for @Airy's posts, they often come up with fun "found image" solutions -- but ask if there are specifics you don't understand (so people don't bury the answer you want under a long ramble about all the options available!).

That was an image of the macro when you were NOT in Edit mode. There is an EDIT button at the bottom of the KM Editor. If you press that button, you can take a screenshot in EDIT mode that will be much more helpful. Or you can read up on how to upload a macro to these forums so that we can edit the macro ourselves.

Oops, I see Nigel answered you with the same answer.

You are welcome for the help. I enjoy helping people. But I'm only right 80% of the time. There are some people here (at least one person) who are (is) right 100% of the time.

Great idea. Find Image is, in my opinion, the biggest jewel on KM's "crown of accomplishment:"

image

Got it! Next time.

OK. Did that. It worked. We got the info in the variable. :clap: :clap:
Waiting for the next action! :heart_eyes:

Okay, now that we know that you have the correct image in the image well, we can use that information to click on its location. There are several ways to do this. I'm going to choose one of those ways. Try this action:

image

YESSSSSS!!! IT WORKS!!! IT WORKS!!! IT WORKS!!!! :joy: :joy: :joy:
Works flawlessly and beautifully!!!
Thanks for leading me like a baby. I'm SO GLAD you did. I feel so happy that I added this knowledge to my small/restricted KM toolbox!!!
Thank you Airy (and all others that helped me)!!!

And you know what? When I went to the discussion in the Apple forum, I read about the app called "PowerPhotos", very recommended...
Guess what? Then I remembered that actually I do have it... :rofl:
Thanks for your help!

1 Like

Thanks. It's always difficult to know how to treat people the right way because you never know what the right way is. Each person has a different background knowledge, is willing to accept a different level of challenge, and might take things personally.

And here is the finished macro (INCLUDING an image FROM EDIT MODE!) :rofl:

Merge duplicate photos Macro (v11.0.3)

Merge duplicate photos.kmmacros (28 KB)

Aesop's Fables

by Aesop

A Man and his son were once going with their Donkey to market. As they were walking along by its side a countryman passed them and said: “You fools, what is a Donkey for but to ride upon?”

So the Man put the Boy on the Donkey and they went on their way. But soon they passed a group of men, one of whom said: “See that lazy youngster, he lets his father walk while he rides.”

So the Man ordered his Boy to get off, and got on himself. But they hadn’t gone far when they passed two women, one of whom said to the other: “Shame on that lazy lout to let his poor little son trudge along.”

Well, the Man didn’t know what to do, but at last he took his Boy up before him on the Donkey. By this time they had come to the town, and the passers-by began to jeer and point at them. The Man stopped and asked what they were scoffing at. The men said: “Aren’t you ashamed of yourself for overloading that poor donkey of yours and your hulking son?”

The Man and Boy got off and tried to think what to do. They thought and they thought, till at last they cut down a pole, tied the donkey’s feet to it, and raised the pole and the donkey to their shoulders. They went along amid the laughter of all who met them till they came to Market Bridge, when the Donkey, getting one of his feet loose, kicked out and caused the Boy to drop his end of the pole. In the struggle the Donkey fell over the bridge, and his fore-feet being tied together he was drowned.

“That will teach you,” said an old man who had followed them:

“Please all, and you will please none.”

Well... I'm content and grateful with what and how you did it!
Good night!