use in

Asked by ledenomejojo

Hi, I'm begginer in sikuli script, and I would like to know How can I do :

click(image)
if click in zone:
 ...

Thank you, and sorry for my english speak, I'm french ^^

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
vitalliuss (vitalliuss) said :
#1

If I understand you right there is necessity to get image x and y.
Try this:

image = find( )
click(image)
print("X:"+str(image.getX())+" Y:"+str(image.getY()))

Output:
X:3 Y:980

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

**** @vitalliuss
a bit misleading: the result of a find is a match not an image.

It is generally more obvious/transparent this way, if you need the match afterwards
click(image)
match = getLastMatch()
if match.x < some_value:
    print "yes, we got it"
else:
    print "sorry, that was the wrong one"

One more thing: formatted output
print "X:%d Y:%d"%(match.x, match.y)

or simply
print match
which gives a readable representation of the match contents

**** @ledenomejojo
If your problem is, that you want to know wether/be sure that you have clicked on the right button, it is recommended, to restrict the region, where to search to the area, where the image most probably can be found:

you might try this in IDE:
reg = selectRegion() # select the area that contains the button
reg.click(image)

If this helps, replace selectRegion() by some other evaluation.

Can you help with this problem?

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

To post a message you must log in.