← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #151845]: How to axcess last find

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
if exists(Pattern(TargetDialog).similar(0.90)):
        print "found"
        m = getLastMatch()
        FKURegion = Region(m.x-20,m.y-10,1000,220)
else:
        print ("Sorry, not found"); exit() # or any corrective action

--- comment:
if find(Pattern(TargetDialog).similar(0.90)):
        print "found"

does not make much sense:
- if not found, your script will stop anyway with exception FindFailed
- so if your script continues, you know, it was found ;-)

so this would be sufficient:

m = find(Pattern(TargetDialog).similar(0.90))
x = m.getX()-20
y = m.getY()-10
w = 1000
h = 220
FKURegion = Region(x,y,w,h)

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