← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #292358]: Look here for (w OR a OR s OR d) and type that.

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
In version 1.1.1 there is a new feature for such cases:
from a list of possible images find the on, that matches best in some region

letter = someRegion.findBest(imgA, imgS, imgW, imgD)

It is not yet in the docs and I would like to check, wether it helps in your situation.
So could you send me a screenshot of the area containing the mentioned 5 regions?
sikulix--at--outlook--dot--com

the  normal solution for such cases:

def checkLetter(reg):
   if reg.exists(imgA, 0): return "A"
   elif reg.exists(imgS, 0): return "S"   
   elif reg.exists(imgW, 0): return "W"
   elif reg.exists(imgD, 0): return "D"
   return None

for reg in (reg1, reg2, reg3, reg4, reg5):
    letter = checkLetter(reg)
    if not letter: 
        print "error checkLetter:", reg
        exit(1)
    # here you can type the letter

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.