← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #684034]: Needs to pick someones brain

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
You might use the Location.getColor() feature.

a sample with the most left bar in your image:
switchApp("opera")
img = Pattern("img.png").targetOffset(-24,1)
patR = Pattern("img.png").targetOffset(21,1)
offsetR = patR.getTargetOffset()
hover(img)
start = Mouse.at()
end = start.offset(offsetR.x * 2, 0)
for n in range(offsetR.x * 2 + 10):
    print start.offset(n,0).getColor().getGreen()

To get specific points in an image (as here the left side middle and the right side middle of the bar) you can use the image Preview feature in the IDE.
There are about 40 pixels to check.
If you use the check-the-middle algorithm, you would have your result latest with 6 checks in a loop:
- test the middle of the bar
- if it is black, test the middle of the left half of the bar
- if it is not black, test the middle of the right half of the bar
- ... hope you got it ;-)

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