← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #231577]: Problem with "with Region()" workaround

 

Question #231577 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/231577

    Status: Open => Answered

RaiMan proposed the following answer:
Sorry, not possible this way (no deeper explanation, since these would
need some programming experience ;-)

regFind is a list of all found matches and cannot be used with with:
(currently ;-)

I made it syntactically/Sikuli-logically correct (but might still not do
what you want - see comments)

   reg = Region(3,542,612,309)
   regFind = reg.findAll(Pattern("img1.png").similar(0.50))
   while regFind.hasNext():
      with Region(regFind.next()): # sets the next match from regFind as default region
        click(mm)
        if exists("img2.png"): # looks in Region(regFind.next())
            reg2 = Region(436,188,337,527)
            if reg2.exists(Pattern("img3.png").similar(0.85)): looks in reg2
                click(reg2.getLastMatch()) # you want to use the last match in reg2 I guess
        if exists(Pattern("img4.png").targetOffset(181,0)): # looks in Region(regFind.next())
            click(getLastMatch()) # clicks lat match in Region(regFind.next())

If getting any errors telling something about indentation: see faq 1800

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