Detecting clicks outside of an element in the interface

Asked by Rita Maia

Hello,

Is it possible in Sikuli to detect a mouse click outsite of an element from an interface?
For example: I want to click on a button, but somehow i clicked outside of the button region but that click should manage to do the same task as if i cliked on the button itself.

If it is possible can you tell me, how can I do this?

Thanks,
Rita

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

when using something like

click(button)

where button is the button image, then SikuliX will click the center of the button image found on screen.

So if it does not click this way, then you have to debug, why that happens.

match = wait(button)
match.highlight(3)
click(match)

If the image is found correctly, then you have a another problem with your system.

If running on Windows 10, then possibly this: bug 1730645

Revision history for this message
Rita Maia (ritamaia07) said :
#2

Thanks for the answer.
But my point is that i want to click outside the button region, by defining a certain padding and with that click do the same process as if i clicked in the button itself.

Do you understand?

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

--- Do you understand?
sorry no.

SikuliX mouse clicks (click()) are the same as if you would do it manually.

So if you click beside the button, then the button is not clicked. No other way to activate the button, than to click on it.
SikuliX is not GUI aware, only visible about the pixels seen on the screen.

May be it helps if you tell a bit more about the intention or about problems you have.

Revision history for this message
Rita Maia (ritamaia07) said :
#4

Let me try to give an example:

I have a button. Then if i click on it i can get the X and Y coordinates right? with functions getX() and getY().

So then if i click outside the button i can get as well the X and Y coordinates , right? And then i define a certain radious. and if the X,Y position is 10px distance from X,Y of the button then i can do an action.

Is my logic correct?

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

--- Is my logic correct?
not really.

No need to click() on an image to get its coordinates.

Might it be, that you did not read the docs until now?

The example is in my comment #1.

Revision history for this message
Rita Maia (ritamaia07) said :
#6

I found on the Sikuli documentation this function: Region
And there is a possible way to extend the region:

http://doc.sikuli.org/region.html

Can you check the "Extending a Region" paragraph?

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

--- Can you check the "Extending a Region" paragraph?
I know how it works.

Did you try anything until now?

Revision history for this message
Rita Maia (ritamaia07) said :
#8

I will try to do it today in the evening.
I was just asking if the function nearby was a good option to proceed.

Can you help with this problem?

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

To post a message you must log in.