← Back to team overview

sikuli-driver team mailing list archive

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

denywinarto gave more information on the question:
Ok. i decided to narrow down the bug trap search(E,F) to one of the image search process (C)
I got it to work, like this:

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)
RegF = Region(SCREEN)
RegG = Region(SCREEN)
def handler(e):
    global isImgA_or_ImgB_or_ImgC_or_ImgD
    isImgA_or_ImgB_or_ImgC_or_ImgD = 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)
def handler2(e):
    global isImgE_or_ImgF_or_ImgG
    isImgE_or_ImgF_or_ImgG = True
RegE.onAppear("XPBLauncherG.png", handler2)
RegF.onAppear(Pattern("QondErrorRep.png").similar(0.88), handler2)
RegG.onAppear(Pattern("1346088182875.png").similar(0.79), handler2)
while True:
    RegA.observe(FOREVER,background=True)
    RegB.observe(FOREVER,background=True)
    RegC.observe(FOREVER,background=True)
    RegD.observe(FOREVER,background=True)
    isImgA_or_ImgB_or_ImgC_or_ImgD = False
    while not isImgA_or_ImgB_or_ImgC_or_ImgD:
        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
        exitC
    elif RegC.exists(Pattern("1346051181203.png").similar(0.89),0):
        doubleClick(Pattern("1346051181203.png").similar(0.89))
        while True:
            RegE.observe(FOREVER,background=True)
            RegF.observe(FOREVER,background=True)
            RegG.observe(FOREVER,background=True)
            isImgE_or_ImgF_or_ImgG = False
            while not isImgE_or_ImgF_or_ImgG:
                wait(1)
            RegE.stopObserver()
            RegF.stopObserver()
            RegG.stopObserver()
            if RegE.exists("XPBLauncherG.png"):
                click(Pattern("OK.png").similar(0.86))
                import pointblank
            elif RegF.exists(Pattern("QondErrorRep.png").similar(0.88),0):
                click(Pattern("1345976311187.png").similar(0.92))
                import pointblank
                break
                exit
            elif RegG.exists(Pattern("1346088182875.png").similar(0.79)):
                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

But when i got
"ImportError: No module named pointblank"
(pointblank is the name of this script)
i thought according to this http://sikuli.org/docx/globals.html

We only need 
import scriptname
?

What am i missing here?
Or is it impossible to import same script?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.