For Each Image Found - in a Collection of unique images

I have a macro that runs and searches for a specific image on screen (there could be 0 - say 100 of each image). There are multiple macros that each run to detect a different image (the image is the same but each image has a slightly different color). So in order to do this currently I have 40 macros that run - that are essentially identical except for the slightly different color image. Each macro has a "For Each Item / For each imageVar in these collections: The Found Images ..." etc.

Well, I'm hoping there is a way that I can create 1 macro and have it run through a collection of images, but in a specific order. For a simple example: If I'm looking for ImageA (red), ImageB (green), and ImageC (blue). I need to find every ImageA and then run a 'Group of Actions', then find every ImageB and run the same 'Group of Actions', then find all ImageC and run 'Group of Actions' and so on.

It would basically be similar to a "For Each %Variable% in these collections: The lines in:" but it would cycle through images rather than lines in a variable.

Any help is much appreciated!


Put the “Group of Actions” in a sub-macro, and then use a sequence of For Each actions, each of which just uses Execute a Macro action to execute the sub-macro.

I think storing the image in a variable, or storing all the images in a text file as base64 and then using 'the Files in directory' will probably be my best option.

Thanks Peter!