Find Image in 10 Windows or More

Hi, I want to search for an image in 10 or more windows and I wanted to create a macro that searches the first window and if it does not find it, go to the second and so on until I find the image and finish the macro.
This is my macro:
Captura de pantalla 2021-12-12 a las 20.51.15

but it only works once and does not loop.
any option?
Thank you

at the top right of the If action in your screenshot,
you'll see there's a Gear with a clock inside it.
Click it,
and uncheck "abort on failure"

I think he thinks that this macro will "loop". I'm meditating on what to say.

I want go yo Windows 1 if image not found go to windows 2 if not found go to Windows 3……. If found image un Windows for example then stop the macro.

I hope I have explained myself well.

Thx

Are the windows overlapping or tiled and all visible? Or are they hidden from view behind another window? Could they be minimized or hidden, and require activation first? If I don't know what you want, I can't write a solution. There are so many possible ways to interpret your question. And when the image is found, (if it is found!) do you want the macro to press a key, or click a button, or stop? In your last message you said "stop" but in your first message you showed that you wanted to click a key.

And why do you mention 10 windows? If you want "10 or more" then really you want as many windows as macOS supports, right? So the number 10 isn't relevant. It could be any number. Or it could be as low as zero.

Hey @keyboardoscar,

Welcome to the forum!  :sunglasses:

You haven't provided a loop – you have an If-Then action and a hanging continue-loop action.

I haven't done this in ages, but if I remember correctly you'll need a For-Each action with found-images condition.

image

This may need to be contained in your If-Then action depending upon what you are doing...

-Chris

hi, thanks for trying to help me.
I have made a gif where you can see what I want to do, I hope it is understood. you only see one window at a time the others are behind.
1

I have done is duplicate the command several times and for now it works but I think there has to be an easier solution.

thx

1 Like

If you want to cycle through windows until an image is found, you could do something like this:

Example Macro.kmmacros (36.7 KB)

2 Likes

That app looks like Pages and Pages is AppleScript Enabled so you should be able to use AppleScript instead of Find Image to read the text and find if the text contains any image. You won't even have to display each image, you'll be able to jump to it instantly.

I'm not very good with AppleScript, so if you want that approach, which will probably be a lot faster, ask the wizards here.

thx @gglick work fine!!!

2 Likes