← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #232479]: limited time of script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
There is no easy way to do that (you guessed right about the reason why
your approach does not work).

You have to change your "while True:" loops to loops  like "while time.time() - start < maxTime", where start and maxTime are global values.
You might even set individual values for your functions, by implementing a maxTime parameter for the functions:

def Function1(maxTime=FOREVER):
      while time.time() - start < maxTime:
             if exists(IMG,0):
                    break
                    wait(1)

start = time.time()
Function1(500)

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