Jump to content

how to move the mouse


seres
 Share

Recommended Posts

when i try to make the mose move in the upper right direction it goes right then up.

can it go at the same time like the real mouse?

#Include <Misc.au3>

Global $Step = 25

While 1

$sPos = MouseGetPos()

If _IsPressed("25") Then MouseMove($sPos[0]-$Step,$sPos[1])

If _IsPressed("26") Then MouseMove($sPos[0],$sPos[1]-$Step)

If _IsPressed("27") Then MouseMove($sPos[0]+$Step,$sPos[1])

If _IsPressed("28") Then MouseMove($sPos[0],$sPos[1]+$Step)

WEnd

Link to comment
Share on other sites

when i try to make the mose move in the upper right direction it goes right then up.

can it go at the same time like the real mouse?

It does that because that is exactly what your code tells it to do.

Maybe this will work better (uses number pad):

#Include <Misc.au3>

HotKeySet("{ESC}", "_Quit")

Global $Step = 25
While 1
    Select 
        Case _IsPressed("67") ; "7"
            $DeltaX = -1
            $DeltaY = -1
        Case _IsPressed("68") ; "8"
            $DeltaX = 0
            $DeltaY = -1
        Case _IsPressed("69") ; "9"
            $DeltaX = +1
            $DeltaY = -1
        Case _IsPressed("66") ; "6"
            $DeltaX = +1
            $DeltaY = 0
        Case _IsPressed("63") ; "3"
            $DeltaX = +1
            $DeltaY = +1
        Case _IsPressed("62") ; "2"
            $DeltaX = 0
            $DeltaY = +1
        Case _IsPressed("61") ; "1"
            $DeltaX = -1
            $DeltaY = +1
        Case _IsPressed("64") ; "4"
            $DeltaX = -1
            $DeltaY = 0
        Case Else
            ContinueLoop
    EndSelect
    MouseMove(MouseGetPos(0) + ($DeltaX * $Step), MouseGetPos(1) + ($DeltaY * $Step))
WEnd

Func _Quit()
    Exit
EndFunc

:P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...