How to find and click 100% or 99% match images in sikuli?

Asked by M

How to find and click 100% or 99% match images in sikuli? I want the code snippet and if any declarations are required for the classes/functions, then please let me know that too before using them. Thanks in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

all is in the docs:
http://sikulix-2014.readthedocs.org/en/latest/index.html

version 1.0.1+

Jython:
find(Pattern(image).exact())
click()
... and in the Sikuli IDE use the Preview feature

Java:
scr = new Screen();
scr.find(find(new Pattern(image).exact())
scr.click()

Revision history for this message
M (meg-2604) said :
#2

Hi, I'm not able to find the 99% match with that function. Any alternatives for this?

Revision history for this message
RaiMan (raimund-hocke) said :
#3

please show me your relevant coding.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

what Sikuli version?

Revision history for this message
Eugene S (shragovich) said :
#5

@M

Are you interested in finding objects with 99% match specifically?

If so you can try this to check found object's similarity score like that:

res = find(pattern)
print res.getScore()

In case of an exact match, you will get:
1.0

In case of non 100% match, you will get something like this:
0.997599840164

Then you can work with these numbers.

Eugene

Revision history for this message
M (meg-2604) said :
#6

Hi,
I have another doubt. When I'm doing form validation like entering a password in the password box by using the screenshot of the password text box, the next time in the loop, the exact match of the password text box is not found because earlier it was an empty text box and now it has some text. So the match fails. How to overcome this problem? Is there a way to compare or click images at run time?

Revision history for this message
RaiMan (raimund-hocke) said :
#7

You have to use the part of the password box, that does not contain the entered password (usually some label text left or above, together with part of the field border) and use a targetOffset for the click point.
Or use some other image, that is visible together with the password box and again use targetOffset to define the click point inside the box relative to this image.

Revision history for this message
M (meg-2604) said :
#8

Hi RaiMan, it would be helpful if you could give the code snippet for the same.
From the explanation above my understanding is that I have to be using the text box with some text as the initial image for comparison and then use target offset to get the exact click point. Is that right?

Revision history for this message
RaiMan (raimund-hocke) said :
#9

easiest and most effective approach:
send me a screenshot of your password box situation (whole application window, initial or filled does not matter) and I will return a fitting snippet

Revision history for this message
RaiMan (raimund-hocke) said :
#10

... silently to my mail at https://launchpad.net/~raimund-hocke

Revision history for this message
RaiMan (raimund-hocke) said :
#11

you have to send from you normal mail program

Can you help with this problem?

Provide an answer of your own, or ask M for more information if necessary.

To post a message you must log in.