Image class keeps selecting different images instead of identical, how to fix? Sikuli
<p>I'm using the random 5 card shuffler to get the hang of some basic scripting, but the script will select A A 3 or 10 9 8 instead of just ignoring them. How could I get it to run faster?</p>

<pre><code>running = True

def runHotkey(event):
    global running
    running = False

Env.addHotkey(Key.F1, KeyModifier.CTRL, runHotkey)

while exists("1474199877323.png")and running:
    click(Pattern("1474369588947.png").similar(0.80))
    wait(2)
    click("1474138615993.png")
    click("1474138629993.png")
    wait(1)
    imageCount=0
    images = []
    # find all images and store them in a list to prevent additional search
    if exists(Pattern("1474368132347.png").similar(0.90)):
            for image in findAll(Pattern("1474368132347.png").similar(0.89)):  
            wait(1)
            images.append(image)
            #check list length and act accordingly
        if len(images) &gt;= 2:
            wait(1)
            for image in images:
                wait(1)
                image.click()
            click(Pattern("1474409820809.png").similar(0.93))


if exists(Pattern("1474409495397.png").similar(0.91)):
        for image1 in findAll(Pattern("1474409495397.png").similar(0.91)):
            wait(1)
            images.append(image1)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image1 in images:
                wait(1)
                image1.click()
            click(Pattern("1474369529687.png").similar(0.90))

if exists(Pattern("1474410728933.png").similar(0.95)):
        for image2 in findAll(Pattern("1474410728933.png").similar(0.95)):
            wait(1)
            images.append(image2)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image2 in images:
                wait(1)
                image2.click()
            click(Pattern("1474369529687.png").similar(0.90))  

if exists(Pattern("1474411088984.png").similar(0.91)):
        for image3 in findAll(Pattern("1474411088984.png").similar(0.91)):  
            wait(1)
            images.append(image3)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image3 in images:
                wait(1)
                image3.click()
            click(Pattern("1474409820809.png").similar(0.93))


if exists(Pattern("1474411136494.png").similar(0.93)):        
        for image4 in findAll(Pattern("1474411136494.png").similar(0.93)):
            wait(1)
            images.append(image4)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image4 in images:
                wait(1)
                image4.click()
            click(Pattern("1474369529687.png").similar(0.90))

if exists(Pattern("1474411200166.png").similar(0.94)):        
        for image5 in findAll(Pattern("1474411200166.png").similar(0.94)):
            wait(1)
            images.append(image5)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image5 in images:
                wait(1)
                image5.click()
            click(Pattern("1474369529687.png").similar(0.90))    

if exists(Pattern("1474411297233.png").similar(0.94)):        
        for image6 in findAll(Pattern("1474411297233.png").similar(0.94)):  
            wait(1)
            images.append(image6)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image6 in images:
                wait(1)
                image6.click()
            click(Pattern("1474409820809.png").similar(0.93))


if exists(Pattern("1474411373675.png").similar(0.94)):                    
        for image7 in findAll(Pattern("1474411373675.png").similar(0.94)):
            wait(1)
            images.append(image7)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image7 in images:
                wait(1)
                image7.click()
            click(Pattern("1474369529687.png").similar(0.90))

if exists(Pattern("1474411438209.png").similar(0.92)):                    
        for image8 in findAll(Pattern("1474411438209.png").similar(0.92)):
            wait(1)
            images.append(image8)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image8 in images:
                wait(1)
                image8.click()
            click(Pattern("1474369529687.png").similar(0.90))  

if exists(Pattern("1474411516981.png").similar(0.95)):        
        for image9 in findAll(Pattern("1474411516981.png").similar(0.95)):  
            wait(1)
            images.append(image9)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for image9 in images:
                wait(1)
                image9.click()
            click(Pattern("1474409820809.png").similar(0.93))                 

if exists(Pattern("1474411592794.png").similar(0.92)):                    
        for imagea in findAll(Pattern("1474411592794.png").similar(0.92)):
            wait(1)
            images.append(imagea)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for imagea in images:
                wait(1)
                imagea.click()
            click(Pattern("1474369529687.png").similar(0.90))

if exists(Pattern("1474411644943.png").similar(0.90)):                    
        for imageb in findAll(Pattern("1474411644943.png").similar(0.90)):
            wait(1)
            images.append(imageb)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for imageb in images:
                wait(1)
                imageb.click()
            click(Pattern("1474369529687.png").similar(0.90))  

if exists(Pattern("1474411713586.png").similar(0.90)):                    
        for imagec in findAll(Pattern("1474411713586.png").similar(0.90)):
            wait(1)
            images.append(imagec)
            #check list length and act accordingly
        if len(images) &gt;= 3:
            wait(1)
            for imagec in images:
                wait(1)
                imagec.click()
            click(Pattern("1474369529687.png").similar(0.90))                       
else:
    wait(0)
</code></pre>

<p>If There are more than one match for given image at given similarity, sikuli click only one image (Randomly) out of it. So if you want to click similar images with more stably you need to develop code using findAll function and later sort the Match results of findAll function and click one of it. You can sort the images depending on co-ordinates of Match Objects found after findAll and click on one of image after sort.</p>

<p>if you want to process (click) on every found Match, directly iterate through all the output results of findAll and do action. No need to do sorting in this case.</p>

python jython sikuli