← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #235158]: How to action (edit. click) for matrix pictures (n column, m rows)

 

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

RaiMan proposed the following answer:
-at 1.
ref = find("some fixed visual element near pic11.png").targetOffset(x,y)

Sorry for bad code.
This is what I wanted to write:
ref = find(Pattern("some fixed visual element near pic11.png").targetOffset(x,y))

This happens:
- find will find the image "some fixed visual element near pic11.png"
- it creates a match object as ref, that has the information: when this is clicked, then use as click point a point with offset (x,y)
from the center of the match.

at 1a:
can be created by IDE Preview:
- capture the image
- click on the thumbnail
- on tab target offset you can do that

When back, hovering over the thumbnail will reveal, that it is now something like
Pattern("some fixed visual element near pic11.png").targetOffset(x,y)
and a little red cross is seen in the thumbnail now
(when using view -> menuShowThumbs (ctrl-t) toggles between image thumbs and real code (you might even change that and switch back again)

at 1b:
a targetOffset(0,0) will be the center of the match/image

at 1c: 
pic11 = ref.getTarget() # center of first image

pic11 now is a point somewhere inside pic11, since ref.getTarget()
returns the point, that is defined by setting the offset before with
preview in the Pattern.

Now that the code is correct, you can just try a little example, e.g. on
this page here:

ref = find("sikuli logo in the upper left corner.png).targetOffset(x,y)

with Preview just set the offset so that it points to the menu entry
<Bugs>

menuBugs = ref.getTarget()
click(menuBugs)
wait(5) # just to see what happens

the bugs page should open.

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