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

Description changed to:
Hi Rainman, hope I'm not abusing, this is the most difficult script I
would ever dare to make, I made a kinda pseudocode, hope you could help
me. Thanks Advanced.

I have a little 330 x 600 px window (it can't be resized) inside chrome,
inside a flash website, with this inside...

* __ idxxx __ somename
        idxxy __ anothername
        idxxz __ anewname
* __ idxyx __ yetsomename
        idxyy __ yetanothername
* __ idxyz __ yetanewname
        idyxx __ andyetsomename
* __ idyyx __ andyetanothername
        idyzx __ andyetanewname

It is a table listing some names, with a scrollbar at the right side
(cuz the list is larger than 9 names), also some names have at their
left side a "StarImage" (represented by starsign) that are either orange
or black.

I would like to count from top to bottom how many "StarImages" are no matter if 
they are orange or black, any of both colors count as one. (eg. if there are 3 
black and 3 orange, then are 6 in total)
Then I would like to create a variable named...
toclickonVar = 2
So if "toclickonVar = 2" I will click on the second "StarImage" found from top 
to bottom.

But if for example "toclickonVar = 6" and the total "StarImage" count
was 4 (like in example table above), so ImageCount < "toclickonVar" then
I will like to subtract ImageCount from "toclickonVar" and then press
the PageDown key and the Down key (in order to scroll down), then count
again how many "StarImages" are from top to bottom and click on the
new(current) "toclickonVar" if it still is greater than the new(current)
"StarImages" count, then repeat the steps described in this paragraph
from the beginning to the end. (I guess this paragraph is a kindof loop)

Is this possible? I thought about the easiest way to achive this, if you
got better idea pls correct me. So far I have write this...

App.focus("Chrome")
Settings.DelayAfterDrag = 0
Settings.DelayBeforeDrop = 0
Settings.MoveMouseDelay = 0
hover(Pattern("1427842411231.png").similar(0.94))
mouseDown(Button.LEFT)
count = 0
try:
    matches = list(findAll(Pattern("1425879837185.png").exact()))
    count = len(matches)
except FindFailed:
    pass #nothing to do 
print "found:", count

if count > 0:
    sortedMatches = sorted(matches, key=lambda m:m.y) # sorts top to bottom
    hover(sortedMatches[-1]) # take the last one
mouseUp(Button.LEFT)

You helped me with this code, but this only count one type of images, I
need to find two colors of StartImages, I either don't know how to click
on second, third, forth. Thanks Advanced again man.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to