Page 1 of 1

MouseMove to absolute coordinates not working

Posted: 20 Feb 2019, 14:50
by JoeWinograd
[Moderator's note: Topic moved from Bug Reports.]

W7 Pro 64-bit
AHK 1.1.30.01 U32

I'm running a source script (i.e., not compiled) by double-clicking the AHK file in my file manager (Total Commander). Here's the script:

Code: Select all

Sleep 2000 ; to make sure mouse hasn't moved after double-click
MouseMove,100,100
Since I don't have Relative specified as the fourth param, the X and Y coordinates should be treated as absolute values. They are not. The mouse moves to 100,100 relative to my file manager instead of absolute to the screen. Regards, Joe

Re: MouseMove to absolute coordinates not working

Posted: 20 Feb 2019, 15:01
by Helgef
This is documented behaviour,
Coordinates are relative to the active window unless CoordMode was used to change that.
Cheers.

Re: MouseMove to absolute coordinates not working

Posted: 20 Feb 2019, 15:02
by gregster
I think this is a misunderstanding.
JoeWinograd wrote:
20 Feb 2019, 14:50
Since I don't have Relative specified as the fourth param, the X and Y coordinates should be treated as absolute values. They are not. The mouse moves to 100,100 relative to my file manager instead of absolute to the screen. Regards, Joe
You probably overlooked this:
X, Y

The x/y coordinates to move the mouse to, which can be expressions. Coordinates are relative to the active window unless CoordMode was used to change that.
This has nothing to do with the Relative parameter. In your case, the coords are still "treated as absolute values" - but relative to the active window (but this means, absolute window coords). The Relative option would only mean relative to the current mouse position ("as offsets from the current mouse position").

Re: MouseMove to absolute coordinates not working

Posted: 20 Feb 2019, 15:14
by JoeWinograd
Ah, my bad! Thanks to both of you. It is, indeed, documented, and it is, indeed, a misunderstanding of Relative and Absolute on my part. Much appreciated, folks! Regards, Joe