Counting the number of images on screen

I have this script where I count specific images on the screen und proceed to the next step if they have been found.
I’ve got this so far:

put the number of items of EveryImageLocation("x") into someThing
if the number of items in someThing equals 7 
	log "something something"
end if

EggPlant seems to find the images but never gets to the if loop. How can I make sure that images are on the screen and why does the if loop get ignored?

Thanks in advance

Your first line is perfect – it calls the EveryImageLocation function to find every occurrence of your image on the screen, and uses “the number of items” to find out how many times the image was found. If you set a breakpoint after that line and do “put someThing” you should see that number.

The problem is that you then use “the number of items” again. But the number of items in a single number will always be 1. Change that line to “if someThing equals 7” and I think you’ll find it works much better.