← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #205343]: find a highlighted section of the screen

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
based on your screen shot 
(https://dl.dropbox.com/u/42895525/findWhiteShot.png) 
this is my solution:

(download zipped findWhite.sikuli: 
https://dl.dropbox.com/u/42895525/findWhite.sikuli.zip)

# findWhite.sikuli
header = "Header-1.png"
bottom = "bottom.png"
white = "white.png"
mHeader = find(header)
mHeader.highlight(1)
area = mHeader.below()
area.find(bottom).highlight(1)
area.y += 15
area.x += 50
area.w -= 50
area.h = area.getLastMatch().y - mHeader.y - mHeader.h -10
area.highlight(2)
wLine = area.find(white)
wLine.highlight(1)
spot = wLine.y
ah = area.h/5
line = Region(area); line.h = ah
lines = range(0, area.h, area.h/5)
text = None
for off in lines:
    currLine = line.offset(Location(0,off))
    if spot < currLine.y+currLine.h:
        currLine.highlight(1)
        text = currLine.text()
        break
if text: print text
else: print "sorry, not Found"

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