Image search

Just a quick question / help.

I am looking to replace AutoHotKey for my mac.
I was hoping that Apple script can do a image search. What i mean is look for a image on the screen and performing a action.

I my case i want Applescript to continually search for a 2 images and if it see’s one the two images click on that image.

But i also want this is continue doing it untill i press a key for it to stop and press the same key to carry on.

Thanks for any help