Click() Implementation in Code

Asked by jeff on 2020-02-20

Hi,

I'm trying to learn to navigate the code.

Where is the implementation of the Click() call inside the codebase?

https://github.com/sikuli/sikuli

Thanks,
Jeff

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-02-20
Last reply:
2020-02-21
Manfred Hampl (m-hampl) said : #1

The repository that you are referring to is outdated.
See the README.md (bottom half of that page):
!!!This Sikuli X-1.0rc3 IS NO LONGER SUPPORTED !!!

Link to the current repository:
https://github.com/RaiMan/SikuliX1

Code for click():
https://github.com/RaiMan/SikuliX1/blob/master/API/src/main/java/org/sikuli/script/Mouse.java#LC250

RaiMan (raimund-hocke) said : #2

... addition to comment#1:

org.sikuli.Script.Region::click -> org.sikuli.Script.Mouse::click

... and finally the real clicking is done via Java AWT Robot (org.sikuli.Script.DesktopRobot)

be aware: in branch master I am currently doing some massive refactoring (version 2.1.0), so looking into the release branch is safer ;-)

jeff (ffejrekaburb) said : #3

Thank you! I'm starting to get oriented.

I'm interpreting "loc" in this line to mean the coordinates are passed in(?).

 protected static int click(Location loc, int buttons, Integer modifiers, boolean dblClick, Object owner) {
https://github.com/RaiMan/SikuliX1/blob/863393f3c57efdad8f723a7cd3029947ddc2364b/API/src/main/java/org/sikuli/script/Mouse.java#L250

Are the locations recognized via OpenCV? Where is that call?

I'm working to understand the sensitivity of Display geometries on recognition.

RaiMan (raimund-hocke) said : #4

Mouse has nothing to do with recognition.

It simply handles a x/y pixel coordinate and uses Java AWT Robot to do the requested Mouse actions.

Additionally it locks the Mouse for other parallel actions either globally (no region given) or for the given region.

jeff (ffejrekaburb) said : #5

Thanks for the information.

I am using click() inside of sikulixID, where the arguments manifest as click([Image])

I'm thinking the match of that [Image] to screen coordinates is done here?

https://github.com/RaiMan/SikuliX1/blob/ea5558a35378967cbcb1e277e7477bed3da309ed/API/src/main/java/org/sikuli/script/support/SXOpenCV.java#L311

RaiMan (raimund-hocke) said : #6

finally deep down, yes ;-)

But here you would land also, if you start with something like:

finder = Finder(someImage)
finder.find(someOtherImage)
if (finder.hasNext()):
  print Finder.next()

doFindMatch only finds one image in another image (which might be a screenshot).

Can you help with this problem?

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

To post a message you must log in.