← Back to team overview

sikuli-driver team mailing list archive

[Question #232479]: limit time of script

 

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

Hello,

I would like to limit the time of the script. The reason - I use a lot of:

while True:
           if exists():
                   break
                   wait(1)

and sometimes the image doesn't show up and sikuli is waiting forever. But I want to stop it.

I have got a lot of global functions within the "while True" exist.

My prefered solution would look like this:

def Function1():
      while True:
             if exists(IMG,0):
                    break
                    wait(1)
def Function2()
def Function3()

start = time.time()
while time.time() - start < 500 
     Function1()                   #cannot find IMG, IMG won't appear
     Function2()
     Function3()

But this doesn't work, I guess because it is still waiting for IMG to appear.  Do you have any suggestions?

Cheers.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.