is there is anyway on a mac to script this:

Search for a image (that i specify) and click
wait 2 seconds

Search for image and click
wait 2 seconds

loop continuously until i press a button to tell it to stop?

Thanks