Confusion between two images

Asked by Ayush Sharma

Hi,

I want to click on Close Button(Upper Right Corner of an active window), while the same close option is there in a background window. Although the active window's close button looks red and the background window has grey, still my script goes on to click the back ground one rather than active. I tried re-taking the image as well. It did not go very well.

Although its not prominent. Sometimes it still clicks the front close button.

One more thing, the issue is with back button also. Some times the back button is recognized and being clicked, some times it does not recognize it at all and fails.

Any help is appreciated, my project is stuck on this.

Thanks in anticipation

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
Marc W (marrowbones) said :
#1

When I had similar problems, I tried various combinations of:

Maximizing all windows as soon as possible (so windows without focus can't be seen)
Closing windows in other ways (e.g. keyboard shortcuts, or in windows, double-clicking the top left corner)
Changing the sensitivity of the matching - read the docs, but I think something like setMinScore(x) will do it

Revision history for this message
Ayush Sharma (ayush-sharma31) said :
#2

The background windows can not be closed because It has to be in use, also the active window is fixed (can not be maximized, try opening device manager as active window from control panel as background window).

Also can you elaborate more about the sensitivity. What's the syntax for it. Consider image A and image B for eg.

Revision history for this message
Katy (katymagowan) said :
#3

If you click on the image you have taken, a pattern settings box will open and you can turn up the similarity of the image under Matching Preview tab.

Revision history for this message
masuo (masuo-ohara) said :
#4

When there are similar images on a screen, you should narrow a region to search.
Find an image to mark.
And find target image from this image.
And click target image.

[for example1:]
r0 = find("mark.png")
r1 = r0.right(500).highlight(2)
r1.click("target.png")

highlight() is used to recognize the region by sight.
So highlight() is not necessary after debug.

[for example1:]
find("mark.png").right(500).highlight(2).click("target.png")

[This page would be helpful]
http://sikulix-2014.readthedocs.org/en/latest/tutorials/sliders/sliders.html

Revision history for this message
masuo (masuo-ohara) said :
#5
Revision history for this message
Ayush Sharma (ayush-sharma31) said :
#6

Hi Everyone,

Thank you all for your replies. It solved my purpose.
I just want to know one more thing. Can anyone tell me if there is a way of putting the sensitivity to 0.9 directly without doing it manually everytime. I have thousands of pictures and they are already there, i can not re-take them. If this can not be done for existing pictures then how i can set the filter for the next pictures i am going to take.

Thanks in advance

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

look here: http://sikulix-2014.readthedocs.org/en/latest/scripting.html#Settings.MinSimilarity

and set the default to 0.9.

So you only have to use Pattern(image).similar(x.y) where needed.

You might also switch the IDE to text mode (menu view), to see the script code.

Can you help with this problem?

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

To post a message you must log in.