sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #52537
Re: [Question #684034]: Needs to pick someones brain
Question #684034 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/684034
RaiMan proposed the following answer:
ok, this is all I can do for you - other priorities.
Based on the given image shown in browser Opera
The offsets have been manually evaluated in IDE Preview.
Not all bar images in your shot show the left end, so I decided to evaluate right to left.
def init():
switchApp("opera")
pat1R = Pattern("img.png").targetOffset(20,1)
pat1L = Pattern("img.png").targetOffset(-23,1)
offsetR = pat1R.getTargetOffset()
offsetL = pat1L.getTargetOffset()
length = offsetR.x - offsetL.x
hover(pat1R)
start1 = Mouse.at()
pat2 = Pattern("img.png").targetOffset(47,-41)
start2 = start1.offset(pat2.getTargetOffset()).offset(-offsetR.x -1, 0)
pat3 = Pattern("img.png").targetOffset(82,11)
start3 = start1.offset(pat3.getTargetOffset()).offset(-offsetR.x -1, 0)
pat4 = Pattern("img.png").targetOffset(94,-19)
start4 = start1.offset(pat4.getTargetOffset()).offset(-offsetR.x -1, 0)
return (length, start1, start2, start3, start4)
def evalHealth(start):
for n in range(length + 1):
color = start.offset(-n,0).getColor().getGreen()
if color > 50: break
return 100 - int(n * 100.0/length)
length, start1, start2, start3, start4 = init()
print evalHealth(start1)
hover(start2)
print evalHealth(start2)
hover(start3)
print evalHealth(start3)
hover(start4)
print evalHealth(start4)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.