← Back to team overview

sikuli-driver team mailing list archive

[Question #673647]: How would I stop a while loop after n amount of time?

 

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

how would I stop a while loop after 20 seconds if it does not achieve what I want it to achieve.

like this:

from interruptingcow import timeout
try:
    with timeout(60*5, exception=RuntimeError):
        while True:
except RuntimeError:
    pass

------------------------------------------------------------
My Code is as Follows:
while not exists(A.png):   #A.png=9999
    mouseMove(B.png)   #B.png=PLUS
    mouseDown(Button.LEFT) 
else:
    print("check!")
mouseUp()

p.s. I want to add from 0 until 9999, and don't want use click instead mouseDown, 
hope someone can help me, thanks.


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