I'm trying to get the final dragging point (right button) with AutoHotKey:
~RButton::
CoordMode, Mouse, Screen
MouseGetPos, x0, y0
while GetKeyState("RButton")
{
MouseGetPos, x1, y1
Sleep, 10
}
MsgBox X: %x1% Y: %y1%
return
What it does is to wait the RightButton of the mouse to be pressed, gather x0 and y0 (inicial coordinates) and while the button is still pressed it gets the position of the mouse again (each 10 miliseconds).
After that it just displays the final coordinates.
It works nicely in normal environment but in this particular case this script needs to be executed in an application that takes control of the mouse when the right button is pressed. What that particular program does is to bring the mouse pointer to the center of the screen and when the button is realised it leaves it in the initial position. (x1, y1 are always the center of my screen, in pixels).
I believe that internally this program gathers the displacement of the mouse (while dragging) and use it for user interaction.
My question is: is there a way to obtain the real mouse input rather than looking at the screen and searching for the mouse pointer ( ~MouseGetPos) ? Is that achievable with AutoHotKey?
MouseGetPos
should give you the current mouse position. To see how much the mouse moved, just get the absolute value of x0-x1 and of y0-y1 – Michael