Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Move Mouse in a Single Axis
#4
I gave a shot at the rest of your question. Hope it helps.

Note:
  • I keyboard-triggered it to the letter a. I tried to trigger it from Ctrl key up/down but couldn't do it easily through the menu's. Maybe you or Gintaras knows how.
  • I had to use rep loop with ifk- break instead of 'wait K' (wait for for key up) because wait for key up doesn't seem to work if initial trigger is set to be eaten. Maybe there is another better way to manage it. But seems to work!
S

Macro VerticalOrHorizontalCursorMovement
Trigger a     Help - how to add the trigger to the macro
Code:
Copy      Help
int vertical;;;;0 horizontal, 1 vertical

POINT P0; xm P0 ;;save mouse position in P

int sx sy sw sh; GetVirtualScreen sx sy sw sh
double dHeight = sh
double dWidth = sw
double scaleCorrection = dWidth/dHeight
out scaleCorrection

WaitForMouseAction(1);err ret
0.01

POINT P1; xm P1 
int xdiff =  P1.x-P0.x
if xdiff < 0; xdiff =xdiff*-1


int ydiff =  P1.y-P0.y
if ydiff < 0; ydiff =ydiff*-1


if xdiff > (ydiff*scaleCorrection);
,vertical = 0
,OnScreenDisplay "horizontal" 1 0 0 "" 0 0 32
else
,vertical=1
,OnScreenDisplay "vertical" 1 0 0 "" 0 0 32

RECT r

if vertical
,r.top=sy
,r.bottom=sy+sh
,r.left=P0.x
,r.right=P0.x
else
,r.left=sx
,r.right=sx+sw
,r.top=P0.y
,r.bottom=P0.y
ClipCursor &r
rep 10
,0.5
,ifk-(a)
,,break
ClipCursor 0


Messages In This Thread
Move Mouse in a Single Axis - by ken gray - 03-24-2021, 01:34 PM
RE: Move Mouse in a Single Axis - by Gintaras - 03-24-2021, 01:58 PM
RE: Move Mouse in a Single Axis - by ken gray - 03-24-2021, 07:45 PM
RE: Move Mouse in a Single Axis - by stupomer - 04-13-2021, 11:37 AM
RE: Move Mouse in a Single Axis - by ken gray - 04-13-2021, 04:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)