whats computer speak for mouse move up left down right

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

whats computer speak for mouse move up left down right

Post by idiot » Tue Feb 03, 2009 9:44 am

liek instead of moving mouse to x,y what would you code to have mouse move left for x seconds then right for x second then up for x seconds down for x seconds like if mouse was really being used thats more what im looking for
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 03, 2009 1:10 pm

Use a loop, a timer and offsets:

Code: Select all

VBSTART
VBEND

//Move left for 2 seconds
GoSub>MoveMouse,-1,0,2

//Move right for 2 seconds
GoSub>MoveMouse,1,0,2

//Move up for 2 seconds
GoSub>MoveMouse,0,-1,2

//Move down for 2 seconds
GoSub>MoveMouse,0,1,2


SRT>MoveMouse
  Let>offSetX=MoveMouse_Var_1
  Let>offSetY=MoveMouse_Var_2
  Let>duration=MoveMouse_Var_3
  VBEval>Timer,startTime
  Label>moveUp
    GetCursorPos>X,Y
    MouseMove>{%X%+%offSetX%},{%Y%+%offSetY%}
    Wait>0.01
    VBEval>Timer-%startTime%,elapsed
  If>elapsed<duration,moveUp
End>MoveMouse
First parameter is the X axis offset to move each time (1 to move 1 pixel right, -1 to move 1 pixel left), second is Y axis offset increment and third is duration for movement.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Mon Feb 09, 2009 1:03 pm

ok i can get this to work but im having problems getting each directions set so when i press a key it will move in the certain direction like if i wanted
"w" key for upmouse "a" key for leftmouse "s" key for downmouse and "d" key for rightmouse i can get 1 to work at a time but how would i make it so whenever i pressed either of those 4 buttons it would mouse move the correct direction?
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Feb 09, 2009 2:16 pm

Something like this perhaps?

Code: Select all

VBSTART
VBEND

OnEvent>KEY_DOWN,w,0,MoveUp
OnEvent>KEY_DOWN,a,0,MoveLeft
OnEvent>KEY_DOWN,s,0,MoveDown
OnEvent>KEY_DOWN,d,0,MoveRight

Label>eventloop
  Wait>0.02
Goto>eventloop

SRT>MoveLeft
  //Move left for 2 seconds
  GoSub>MoveMouse,-1,0,2
End>MoveLeft

SRT>MoveRight
  //Move right for 2 seconds
  GoSub>MoveMouse,1,0,2
End>MoveRight

SRT>MoveUp
  //Move up for 2 seconds
  GoSub>MoveMouse,0,-1,2
End>MoveUp

SRT>MoveDown
  //Move down for 2 seconds
  GoSub>MoveMouse,0,1,2
End>MoveDown

SRT>MoveMouse
  Let>offSetX=MoveMouse_Var_1
  Let>offSetY=MoveMouse_Var_2
  Let>duration=MoveMouse_Var_3
  VBEval>Timer,startTime
  Label>moveUp
    GetCursorPos>X,Y
    MouseMove>{%X%+%offSetX%},{%Y%+%offSetY%}
    Wait>0.01
    VBEval>Timer-%startTime%,elapsed
  If>elapsed<duration,moveUp
End>MoveMouse
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Mon Feb 09, 2009 10:18 pm

yeah thats exactly what i wanted to do didnt relise i had to sort each one thats why it wasnt working
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

theres got to be another way to do this

Post by idiot » Tue Feb 10, 2009 4:19 am

this code works but not they way i need it to yes this does let you somewhat emulate mouse and i have made it easier to adjust but i need something that works at a lower lvl i think i wanted to basically set it up to where i could push a button and it would turn left or right in doom2 very fast but when i try and use this method it dosen't work correctly in game i basically need to know what information a real mouse is using to move it and use those exact commands but for those who would like to use this here's the modified version that's full customizable upon running it

Code: Select all

// COMPILE_OPTS|C:\Documents and Settings\Administrator\My Documents\Macro Scheduler 11\mouseemulator.exe|C:\Documents and Settings\Administrator\Desktop\doomemulator.ico|CONSOLE=0|INCLUDES=1|
VBSTART
VBEND
Input>%w%,please select key to movemouse up,
Input>%s%,please select key to movemouse down,
Input>%a%,please select key to movemouse left,
Input>%g%,please select key to movemouse right,
Input>%up%,please tell how far to move up  -1/-999,
Input>%down%,please tell how far to move down  1/999,
Input>%left%,please tell how far to move left  -1/-999,
Input>%right%,please tell how far to move right  1/999,
Input>%wait%,please tell how to wait between mouse moves in seconds 0.00 is default,
Input>%fast%,please tell how fast to move mouse 0.00 is fastest 0.00/999.99,
VBSTART
VBEND

OnEvent>KEY_DOWN,%w%,0,MoveUp
OnEvent>KEY_DOWN,%a%,0,MoveLeft
OnEvent>KEY_DOWN,%s%,0,MoveDown
OnEvent>KEY_DOWN,%g%,0,MoveRight

Label>eventloop
  Wait>0.02
Goto>eventloop

SRT>MoveLeft
  //Move left for 2 seconds
  GoSub>MoveMouse,%left%,0,%fast%
End>MoveLeft

SRT>MoveRight
  //Move right for 2 seconds
  GoSub>MoveMouse,%right%,0,%fast%
End>MoveRight

SRT>MoveUp
  //Move up for 2 seconds
  GoSub>MoveMouse,0,%up%,%fast%
End>MoveUp

SRT>MoveDown
  //Move down for 2 seconds
  GoSub>MoveMouse,0,%down%,%fast%
End>MoveDown

SRT>MoveMouse
  Let>offSetX=MoveMouse_Var_1
  Let>offSetY=MoveMouse_Var_2
  Let>duration=MoveMouse_Var_3
  VBEval>Timer,startTime
  Label>moveUp
    GetCursorPos>X,Y
    MouseMove>{%X%+%offSetX%},{%Y%+%offSetY%}
    Wait>%wait%
    VBEval>Timer-%startTime%,elapsed
  If>elapsed<duration>MoveMouse

if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 10, 2009 7:30 am

You originally asked for a key press to move the mouse for a certain duration. Clearly this means there is a delay while the mouse is moved.

If you just want key presses to move the mouse you don't need the duration loop. Just have it get the cursor pos and move one (or more) pixels in one go in the direction required. This will be much faster and the mouse will move each time you hit the key.

E.g.:

Code: Select all

SRT>MoveRight
 GetCursorPos>x,y
 MouseMove>{%x%+5},y
End>MoveRight[code]
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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