Print the current mouse cursors location

Asked by arminius on 2017-06-14

I have designed my program to deliver my mouse cursor to a spectic point in a screen shot, but I need to drag and drop between that position and the center of the screen.
I can't do that without knowing where the point in the screen shot is, so how do I print where the location of the mouse cursor is?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
masuo (masuo-ohara) said : #1

see this document.

To realize what you want to do is not only one way.
Document tell us a lot of things.
To know existence of document is important anytime.

arminius (arminius75) said : #2

I look through those documents, they have almost know examples of the code as it should be run.
I don't run right to the forums, I do give it a go, I tried "getMouseLocation()"
it returned "[error] NameError ( name 'getMouseLocation' is not defined )"
If you have the ear of whoever writes these documents ask them if they could please add more examples, the only other programming I'm familier with is autohotkey and conky, their documents always had code you could use, even if it wasn't quite right you could tweak it.

arminius (arminius75) said : #3

"they have almost no examples of the code as it should be run."
Not sure how to edit posts for bad spelling.

arminius (arminius75) said : #4

ok, I see I was leaving the Env off in "Env.getMouseLocation()"
Doesn't seem to be displaying any useful information as to the mouse's location though.

masuo (masuo-ohara) said : #5

I can print mouse location.

ml = Env.getMouseLocation()
print ml
print ml.getX()
print ml.getY()

arminius (arminius75) said : #6

that solved my problem