Jump to content


Photo

How do I use the mousemove command


  • Please log in to reply
2 replies to this topic

#1 stanman

stanman
  • Members
  • 102 posts

Posted 29 April 2004 - 07:43 PM

I just started using autohotkey and have a question. What I want to do is assign a hotkey to move the mouse cursor from its current position to a postion a little bit to the left (a value of say 10). So I did the following
#n::mousegetpos, xpos, ypos
envset, xps, %xpos% - 10
mousemove, %xps% , %ypos%

am I even close to what this should be is this the right way to do math with a variable because the error I'm getting is that %xpos% - 10 doesn't resolve to a numeric value

any help would be appreciated

#2 beardboy

beardboy
  • Members
  • 443 posts

Posted 29 April 2004 - 08:31 PM

You can do it two ways:

envsub, xpos, 10
or
xpos -= 10
#n::
mousegetpos, xpos, ypos 
envsub, xpos, 10 
mousemove, %xpos% , %ypos%
return
thanks,
beardboy

#3 stanman

stanman
  • Members
  • 102 posts

Posted 30 April 2004 - 01:34 PM

Thanks beardboy

I tried the code and its working fine
its simpler to use just one the variable too

Thanks again