I am using the Click function n sikuli and when I click on the png image and select Matching Preview, it displays whatever I have on my desktop. Isn't the Matching Preview supposed to display the button that I'm trying to click?

Asked by Cam

I am using the Click function in sikuli and when I click on the png image and select Matching Preview, it displays whatever I have on my desktop. Isn't the Matching Preview supposed to display the button that I'm trying to click?

Pls Help Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Roman Podolyan
Solved:
Last query:
Last reply:
Revision history for this message
Roman Podolyan (podolyan-roman) said :
#1

Matching preview is supposed to display what you have on screen, with areas matching the pattern covered by red overlay. That shows you what you get with such matching settings.

Like this:
http://i68.tinypic.com/2h6db7t.jpg
(first match has different color)

If you don't see any areas covered by red overlay, that means that Sikuli doesn't see any match on current screen. If you see several, like on my picture, that means that several areas matches, and if you want only one match you have to play with pattern and similarity to get one match.

Revision history for this message
Cam (cfamili) said :
#2

Thank you very much for responding:)
Pls look at my script below.

I don't see any areas covered in red. When I click on Find(Setup)->Matching Preview..it shows me my desktop. It doesn't show me the Setup button.
When I click on Target Offset..it shows me the Setup button.
I noticed that the png in Find(Setup) is different than the png in Click(Setup)

What am I doing wrong? Thank you.

find(Pattern("1471447653278.png").similar(0.76))
wait(5)
click(Pattern("1471448707420.png").similar(0.86))

find(Pattern("1471457295602.png").targetOffset(4,0)) ---->I'm finding the Setup button here

click("1471457321576.png") ------>I'm clicking the Setup button here

wait(1)

find(Pattern("1471524359924.png").targetOffset(9,1))

click(Pattern("1471374949255.png").targetOffset(-31,15))

Revision history for this message
Best Roman Podolyan (podolyan-roman) said :
#3

It matters what program window you had opened before you clicked Matching preview.
Before you click matching preview, you have to do two things
) Bring to front the window of the application you want Sikuli to operate on, to do that make sure that it is launched and click it's icon in taskbar (Windows or Mac), so that it is visible in front of other windows.
) Bring to front Sikuli, and then use Matching preview.

Revision history for this message
Cam (cfamili) said :
#4

Ok it worked! Thank you very much! :)