sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #12702
Re: [Question #206657]: Wait for image A or B or C forever, then take action accordingly
Question #206657 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/206657
Status: Needs information => Answered
RaiMan proposed the following answer:
totally agree with j
a modified version:
def handler(e):
global isImgA_or_ImgB_or_ImgC
isImgA_or_ImgB_or_ImgC = True
RegA.onAppear(imgA, handler)
RegB.onAppear(imgB, handler)
RegC.onAppear(imgC, handler)
while True:
isImgA_or_ImgB_or_ImgC = False
RegA.observe(FOREVER, background=True)
RegB.observe(FOREVER, background=True)
RegC.observe(FOREVER, background=True)
while not isImgA_or_ImgB_or_ImgC:
wait(1)
RegA.stopObserver()
RegB.stopObserver()
RegC.stopObserver()
if RegA.exists (imgA, 0):
click RegA.getLastMatch()
elif RegB.exists (imgB, 0):
click RegB.getLastMatch()
else:
click (RegC.find(imgC))
Another option would be, to use the observe-match-region.
e.g.
def handler(e):
global someImage
someRegion = e.region
and then compare the regions.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.