MouseMove and MousePlay
Keywords: mousemove mouseplay coordinates
Question:
In the following script, I was expecting if I specified the parent window, that the mouse would move relative to the parent window. Instead, regardless of whether I specify the parent window or not, the mouse always ends up in the middle of the entire screen.windowName="aaa.txt - Notepad" WinActivate(windowName) WinPlace(1, 1, @NORESIZE, @NORESIZE, windowName) TimeDelay(1) x = 500 y = 500 MouseMove(x, y, windowName,'') timedelay(3) Mousemove(100,100,'','') TimeDelay(3) MouseMove(x, y, '','') TimeDelay(3) MouseMove(x, y, windowName,'') exitAnswer:
With mousemove and mouseplay, the unit of measure is always in absolute screen coordinates, not relative window coordinates. Ie, 500 always moves 50% of the size of the entire screen. The relative part, if you specify a parent window, is relative to the upper left edge of the parent window position. It will end up 500 pixels from that position in your example above. If the parent window is positioned close to the left edge of the desktop (as in your case it's 1 pixel to the right and down) then the mouse will end up 1 pixel to the right of the middle of the screen. Because the window's base x/y coordinates are only 1 pixel greater than the desktop's, the "move to" coordinates may get calculated the same due to rounding error when converting from virtual units. But I can see the last move happen on my system (1152x864).