Check-box on 3 different backgrounds

I’m having a heck of a time getting a single image to be seen against a white, purple or grey background. Any suggestions on the best approach to do this without having to create 3 image each of a different background color? I would need to check the box in an un-checked state as well as a checked state.

I am coding this to determine if I need to check the box (Or uncheck it depending on the situation) so if it is already checked I will not not click it, otherwise I will click on the image location.

Pulsing originally appeared to work but I then found that the checked image would pass when the image truely unchecked. Would appreciate any recommendations.

Thanks!

Are you worried about using 3 images because it makes the commands more complicated? If so, you may not be familiar with the technique of using image collections. An image collection is a folder of images that is referenced using just the name of the folder. So you can have a folder named “checkbox” that contains your 3 images with the different background colors (you can call the images anything you want) and another folder named “checked” that contains 3 images of the checked checkbox. You can then look for the unchecked checkbox with simple code:

if imageFound("checkbox") then
     click foundImageLocation()
end if

The code above will find search for each of the checkbox images until it finds one of them, then click the position at which it was found. The search should take only a fraction of a second. The same code specifying the “checked” folder will find the marked checkbox.

Will this solution work for you?

I think that should work. I looked at the collections previously but for some reason thought you had to specify the image within it. I’ll play around with it and see how it works.

I ended up changing my logic rather than looking for the unCheckedBox I searched for the checkedBox, and that seemed to be more reliable for whatever reason against all 3 background colors.

Thanks for the recommendation on collections.