sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04980
Re: [Question #169767]: IF image appears FIRST in 1 of the 2 regions
Question #169767 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/169767
Status: Open => Answered
RaiMan proposed the following answer:
regA = Region(x,y,w,h) # to be specified or evaluated somehow
regB = Region(x,y,w,h) # to be specified or evaluated somehow
img = "the image you are waiting for.png"
isRegA = False
while True:
if regA.exists(img, 0):
isRegA = True
break # appeared in region A
if regB.exists(img, 0):
break # appeared in region B
wait(1) # wait 1 second and try again
if isRegA:
print "running script for A"
else:
print "running script for B"
Since each find with exists(img,0) in a region should cost max 0.5
seconds, with this construct, search in regA starts about every 2
seconds. If img appears within search time in region B before image
appears in region A, region A will win.
Alternatively you might use the observe() feature, but it is more
complex (look docs: http://sikuli.org/docx/region.html#observing-visual-
events-in-a-region)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.