← Back to team overview

sikuli-driver team mailing list archive

[Question #284740]: How to stop loop when an image appears within a fixed region?

 

New question #284740 on Sikuli:
https://answers.launchpad.net/sikuli/+question/284740

I want to stop this script made thanks to a generous member here helped me clean it up if an image appears within a fixed region of the screen, same image will appear on another part of screen every few minutes and sikuli finds that instead of the one i want it to find.

Tried my best to figure out how the Region code works but my knowledge of python is very low just started learning.

>From another question i found the m = find and used it to find where the image shows up on screen

M[896,460 193x56]@S(S(0)[0,0 1366x768]) S:0.96 C:992,488 [1871 msec]

Not sure if thats how you find the x,y,w,h or if its even in there

this is the full script

while True:
    wait("1453202630435-1.png",30),click("1453202630435-1.png")
    wait(80)
# this is where i want to check for the image and quit if it appears
    wait("1453736008362.png",25),click("1453736008362-1.png")
    wait("1453202801705-1.png",25),click("1453202812250.png")
    wait(10)
    Image1 = ("1453723117924-4.png")
    Image2 = ("1453735625632.png")
    while True:
        print('Searching....')
        if exists("1453723117924-5.png"):
            print("1453723117924-6.png")
            click("1453723117924-7.png")
            # Break loop.
            break
        elif exists("1453735625632-1.png"):
            print("1453735625632-2.png")
            click("1453735625632-3.png")
            # Break loop.
            break
        else:
            pass
    wait("1453202882292.png",25),click("1453202882292-1.png")

  Any help much appreciated

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.