sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #12746
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: Answered => Open
denywinarto is still having a problem:
Thanks again raiman,
i managed to get it working,
and yes, you're right, it's because i saved it in root folder lol :p
Just one last thing i can't figure out,
How do i replay the script for this code structure?
I've read https://answers.launchpad.net/sikuli/+faq/1437
But i still can't figure out where to place the while-break,
--------------------------------------------
type("d",KEY_WIN)
doubleClick(Pattern("1346049773218.png").similar(0.85))
RegA = Region(SCREEN)
RegB = Region(SCREEN)
RegC = Region(SCREEN)
RegD = Region(SCREEN)
RegE = Region(SCREEN)
def handler(e):
global isImgA_or_ImgB_or_ImgC_or_ImgD_or_ImgE
isImgA_or_ImgB_or_ImgC_or_ImgD_or_ImgE = True
RegA.onAppear(Pattern("XPBLauncherF.png").similar(0.81), handler)
RegB.onAppear(Pattern("ICIMuhunmaaf.png").similar(0.91), handler)
RegC.onAppear(Pattern("1346051181203.png").similar(0.89), handler)
RegD.onAppear(Pattern("1346049877203.png").similar(0.92), handler)
RegE.onAppear(Pattern("QondErrorRep.png").similar(0.88), handler)
while True:
RegA.observe(FOREVER,background=True)
RegB.observe(FOREVER,background=True)
RegC.observe(FOREVER,background=True)
RegD.observe(FOREVER,background=True)
RegE.observe(FOREVER,background=True)
isImgA_or_ImgB_or_ImgC_or_ImgD_or_ImgE = False
while not isImgA_or_ImgB_or_ImgC_or_ImgD_or_ImgE:
wait(1)
RegA.stopObserver()
RegB.stopObserver()
RegC.stopObserver()
RegD.stopObserver()
if RegA.exists(Pattern("XPBLauncherF.png").similar(0.81),0):
click(Pattern("OK.png").similar(0.86))
break
exit
elif RegB.exists(Pattern("ICIMuhunmaaf.png").similar(0.91),0):
click(Pattern("OK.png").similar(0.86))
break
exit
elif RegC.exists(Pattern("1346051181203.png").similar(0.89),0):
doubleClick(Pattern("1346051181203.png").similar(0.89))
wait(Pattern("1346088182875.png").similar(0.79), FOREVER)
click(Pattern("Y.png").similar(0.83))
click(Pattern("1346050299265.png").similar(0.83))
break
exit
elif RegD.exists(Pattern("1346049877203.png").similar(0.92),0):
click(Pattern("Y.png").similar(0.83))
click(Pattern("1346050299265.png").similar(0.83))
break
exit
->elif RegE.exists(Pattern("ErrorReport.png").similar(0.88),0):
click(Pattern("Dontsend.png").similar(0.92))
RegE.stopObserver()
break
exit-<
-------------------------------------------------------
See the "->"?
Basically i want it to repeat the script whenever it crashes and found a bug when the program is running,
(you know, the 'send error report' page)
I'm unsure where to place the While True,
If i place it in the beginning, it won't be able to search the send error report image continuously..
Any idea?
*nb: just a feedback, perhaps you could make it compatible with jre 1.7?
There might be alot of users asking about incompability, since by default java always gives newest jre on their site
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.