sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #51120
Re: [Question #679532]: How to stop waiting in main script by observer handler
Question #679532 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/679532
Status: Open => Answered
RaiMan proposed the following answer:
ok, then there are only 2 options left:
--- make the loop in a batch file on commandline using the brute force
method comment #6, check the returncode and repeat the scriptrun if
appropriate
--- integrate the continuation logic ito your workflow.
with 1.1.4 there might be another option instaed of observing: findany
https://sikulix-2014.readthedocs.io/en/latest/region.html#find-more-than-one-image-in-a-region-at-the-same-time
you can pack it in a def:
def checkImageAndError(image, errorImage, time):
# time in seconds
end = time.time() + time
while time.time() < end:
matches = findAny(image, error)
if (len(matches) == 0):
wait(3)
continue
if (len(matches == 1)): # one image found
if matches[0].getIndex == 0:
return matches[0] # good image
else:
return None # error image
return None # both images found
# ... and then instaed of
wait("1.png",300)
# use
match = checkError("1.png", "error.png", 300)
if not match: continue
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.