Mousemove and GetCursorPos

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
johnc3640
Newbie
Posts: 9
Joined: Tue Oct 26, 2004 2:23 pm

Mousemove and GetCursorPos

Post by johnc3640 » Sun Sep 15, 2013 6:56 pm

I realize that the answer to this should be obvious but I am stumped.

The following code:

GetScreenRes>xWidth,xHeight
MouseMove>1280,720
GetCursorPos>X,Y,cType

resulted in the following values:

xWidth=1280
xHeigth=720

x=853
y=480

Why doesn't the MouseMove and GetCursorPos yield the same result (no the mouse did not move in between lines)? Also, after the mouse moved, as a result of the above step, it did not end up in the bottom right hand corner of the screen.

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sun Sep 15, 2013 10:33 pm

Are you trying to move your cursor past your screen resolution? Because that's not possible.

Try this example:

Code: Select all

GetScreenRes>xWidth,xHeight
MouseMove>500,400
GetCursorPos>X,Y,cType

MDL>Screen Resolution: %xWidth%,%xHeight%%CRLF%Cursor Position: %X%,%Y%%CRLF%Cursor Type: %cType% 


johnc3640
Newbie
Posts: 9
Joined: Tue Oct 26, 2004 2:23 pm

Post by johnc3640 » Mon Sep 16, 2013 1:24 pm

No, I am not trying to move the mouse beyond the screen. I have the same issure if the starting mouse move was to 200,200 - MouseMove and GetCursorPos do not result in/return the same location.

PaulSR
Pro Scripter
Posts: 65
Joined: Mon Aug 05, 2013 2:58 pm
Location: Edinburgh/Peterborough

Post by PaulSR » Mon Sep 16, 2013 2:11 pm

I think having the cursor type is your problem there JohnC - have you tried removing that? It's optional.

GetScreenRes>xWidth,xHeight
//MouseMove>xWidth,xHeight
MouseMove>1080,720
GetCursorPos>X,Y

messagemodal>%xWidth% %CRLF% %xheight% %CRLF% %X% %CRLF% %Y%

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1417
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Tue Sep 17, 2013 3:04 am

I can't replicate the problem, even if I keep the cursor type in.

I'm on a 1600x900. I used this :

Code: Select all

GetScreenRes>xWidth,xHeight
MouseMove>1280,720
GetCursorPos>X,Y,cType
mdl>Resolution is %xWidth% x %xHeight%%CRLF%Cursor co-ordinates and type %X%,%Y%,%cType%


GetScreenRes>xWidth,xHeight
MouseMove>%xWidth%,%xHeight%
GetCursorPos>X,Y,cType
mdl>Resolution is %xWidth% x %xHeight%%CRLF%Cursor co-ordinates and type %X%,%Y%,%cType%




The first section gets the screen resolution, moves the mouse to 1280,720, then reports the mouse position correctly as 1280,720.

The second part gets the resolution, moves the mouse pointer to the bottom right corner, and correctly reports the mouse position.

johnc3640
Newbie
Posts: 9
Joined: Tue Oct 26, 2004 2:23 pm

Post by johnc3640 » Tue Sep 17, 2013 12:54 pm

I am using a 27 inch widesreen monitor 1600 by 1200. Macroscheduler does not recognize this size - but for some reason the program returns different values for these functions.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Sep 18, 2013 4:42 am

What does GetSystemMetrics report?

Code: Select all

  Let>SM_XVIRTUALSCREEN=76
  Let>SM_YVIRTUALSCREEN=77
  Let>SM_CXVIRTUALSCREEN=78
  Let>SM_CYVIRTUALSCREEN=79

  LibFunc>User32,GetSystemMetrics,VScrWidth,SM_CXVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrHeight,SM_CYVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrLeft,SM_XVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrTop,SM_YVIRTUALSCREEN
  
  MDL>%VScrLeft%,%VScrTop% - %VScrWidth%,%VScrHeight%

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts