Sign in to follow this  
Followers 0
gottygolly

MouseMove with Arrow Keys

3 posts in this topic

#1 ·  Posted (edited)

It's working fine but I just want to make it go faster without it being so jumpy (skipping pixels) and I just don't how to do it, hopefully someone else does.

Thanks.

#include<misc.au3>
Func exits()
   Exit
EndFunc
while 1
   Sleep(100)
   HotKeySet("{F1}","exits")

If _IsPressed("25") Then ;left
   $mouse_pos = MouseGetPos()
   $lx = $mouse_pos[0] - 2
   ;$ly = $mouse_pos[1] + 5
   MouseMove($lx,$mouse_pos[1],1)
EndIf

If _IsPressed("26") Then ;up
   $mouse_pos = MouseGetPos()
   ;$lx = $mouse_pos[0] - 5
   $ly = $mouse_pos[1] - 2
   MouseMove($mouse_pos[0],$ly,1)
EndIf

If _IsPressed("27") Then ;right
   $mouse_pos = MouseGetPos()
   $lx = $mouse_pos[0] + 2
   ;$ly = $mouse_pos[1] + 5
   MouseMove($lx,$mouse_pos[1],1)
EndIf

If _IsPressed("28") Then ;down
   $mouse_pos = MouseGetPos()
   ;$lx = $mouse_pos[0] - 5
   $ly = $mouse_pos[1] + 2
   MouseMove($mouse_pos[0],$ly,1)
   EndIf
WEnd
Edited by gottygolly

Share this post


Link to post
Share on other sites



The sleep(100) tells your script to pause for 100ms. This makes it exectue around 10 times every second. If you reduce the sleep to 10 it would execute 100 times each second instead.

For each execution you move the mouse 2 pixels at the time ($mouse_pos[0] - 2). you can also play around with this, if you reduce/increase it will move the mouse a different amount of pixels for each execution.


Share this post


Link to post
Share on other sites

I failed to realize that the Sleep(100) was affecting the whole script. I played around with the pixel move and 2 seems to be the best.

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0