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

Hi,

I try to optimize my script from:

if exists(img1,0) or exists(img2,0) or ....:
     do something

to a better readable version by using a list and findBest.

So I made a list of images and repeat a function to click on different existing 
images, looking almost the same.
But in my case my function always clicks the same spot, found within the first 
round, even if it's not existing anymore.

any advice how to tell the function to search again new?

item_list = findBest{img1,img2,img3)

def doIt():
        for i in range(1,4,+1):
                if item_List:
                        Lclick(item_List)
                        print('found and clicked item')
                        sleep(random.uniform(0.4, 0.6))
                else:break

Lclick() is my own def to click somewhere inside the region:

def Lclick(region):
    CoOrdData = (region)
    CoOrdDatax = CoOrdData.x + int(CoOrdData.w * random.random())
    CoOrdDatay = CoOrdData.y + int(CoOrdData.h * random.random())
    click(Location(CoOrdDatax, CoOrdDatay))

I am also wondering, if I can define a wait time like in using if 
exists(img,WAITTIME): for my list images?

Greetings 😄


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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to