Jump to content

MouseMove with Arrow Keys


Recommended Posts

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
Link to comment
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.


Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...