Find multiples of the same image on a screen?

I want to make sure that an image shows up x amount of times on the same screen.

EG... I want to make sure there are 5 of "bell" for instance.

???

Comments

  • Bass-O-Matic,

    Depending on if you are verifying a specific number of occurrences of that image or that there are at least that number of occurrences, you will want to add a variation on this example code.

    Here I have captured an image of the close out button on a window (disabled) and run the function EveryImageLocation on it, which returns a list of all of the different locations of that image found. Then I created the variable NumberOfImages to store the results of the EveryImageLocation search in order to evaluate the quantity. At the end of this evaluation the script will put true or false based on whether or not there are three windows in view.
    put EveryImageLocation ("close_window") into NumberOfImages
    if the number of items in NumberOfImages is 3 then put true else put false
    

    Here I have used the same image but asked it to verify that there are at least three:
    put EveryImageLocation ("close_window") into NumberOfImages
    if the number of items in NumberOfImages is at least 3 then put true else put false
    

    I hope that answers your question!

    -Elizabeth
Sign In or Register to comment.