Jump to content

How can I control the mouse pointer with the gamepad?


tobi2006
 Share

Recommended Posts

i wrote a mouse control utility for the numpad, redefine the hotkeys to your gamepad's keys

Global $Disabled = 0, $speed = 10
#include <Misc.au3>
Opt("TrayAutoPause", 0)
HotKeySet("{NUMPAD1}", "m1")
HotKeySet("{NUMPAD3}", "m3")

HotKeySet("{NUMPAD2}", "m2")
HotKeySet("{NUMPAD4}", "m4")
HotKeySet("{NUMPAD6}", "m6")
HotKeySet("{NUMPAD8}", "m8")

HotKeySet("{NUMPAD7}", "m7")
HotKeySet("{NUMPAD9}", "m9")
HotKeySet("{NUMPAD5}", "m5")

HotKeySet("{NUMPADDOT}", "mdot")

While 1
    Sleep(100)
WEnd

Func m1()
    HotKeySet("{NUMPAD1}")
    MouseDown("left")
    While _IsPressed(61)
        Sleep(100)
    WEnd
    MouseUp("left")
    HotKeySet("{NUMPAD1}", "m1")
EndFunc   ;==>m1

Func m3()
    HotKeySet("{NUMPAD3}")
    MouseDown("right")
    While _IsPressed(63)
        Sleep(100)
    WEnd
    MouseUp("right")
    HotKeySet("{NUMPAD3}", "m3")
EndFunc   ;==>m3

Func m2()
    $pos = MouseGetPos()
    MouseMove($pos[0], $pos[1] + $speed, 1)
EndFunc   ;==>m2

Func m4()
    $pos = MouseGetPos()
    MouseMove($pos[0] - $speed, $pos[1], 1)
EndFunc   ;==>m4

Func m6()
    $pos = MouseGetPos()
    MouseMove($pos[0] + $speed, $pos[1], 1)
EndFunc   ;==>m6

Func m8()
    $pos = MouseGetPos()
    MouseMove($pos[0], $pos[1] - $speed, 1)
EndFunc   ;==>m8

Func m7()
    $speed = $speed - 1
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m7

Func m9()
    $speed = $speed + 1
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m9

Func m5()
    If $speed = 10 Then
        $speed = 50
    Else
        $speed = 10
    EndIf
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m5

Func mdot()
    Switch $Disabled
        Case 0
            HotKeySet("{NUMPAD1}")
            HotKeySet("{NUMPAD3}")

            HotKeySet("{NUMPAD2}")
            HotKeySet("{NUMPAD4}")
            HotKeySet("{NUMPAD6}")
            HotKeySet("{NUMPAD8}")

            HotKeySet("{NUMPAD7}")
            HotKeySet("{NUMPAD9}")
            HotKeySet("{NUMPAD5}")
            TrayTip("Virtual Mouse", "You have disabled Virtual Mouse", 3)
            $Disabled = 1
        Case 1
            HotKeySet("{NUMPAD1}", "m1")
            HotKeySet("{NUMPAD3}", "m3")

            HotKeySet("{NUMPAD2}", "m2")
            HotKeySet("{NUMPAD4}", "m4")
            HotKeySet("{NUMPAD6}", "m6")
            HotKeySet("{NUMPAD8}", "m8")

            HotKeySet("{NUMPAD7}", "m7")
            HotKeySet("{NUMPAD9}", "m9")
            HotKeySet("{NUMPAD5}", "m5")
            TrayTip("Virtual Mouse", "Virtual Mouse is now Enabled", 3)
            $Disabled = 0
    EndSwitch
EndFunc   ;==>mdot
Link to comment
Share on other sites

i wrote a mouse control utility for the numpad, redefine the hotkeys to your gamepad's keys

Global $Disabled = 0, $speed = 10
#include <Misc.au3>
Opt("TrayAutoPause", 0)
HotKeySet("{NUMPAD1}", "m1")
HotKeySet("{NUMPAD3}", "m3")

HotKeySet("{NUMPAD2}", "m2")
HotKeySet("{NUMPAD4}", "m4")
HotKeySet("{NUMPAD6}", "m6")
HotKeySet("{NUMPAD8}", "m8")

HotKeySet("{NUMPAD7}", "m7")
HotKeySet("{NUMPAD9}", "m9")
HotKeySet("{NUMPAD5}", "m5")

HotKeySet("{NUMPADDOT}", "mdot")

While 1
    Sleep(100)
WEnd

Func m1()
    HotKeySet("{NUMPAD1}")
    MouseDown("left")
    While _IsPressed(61)
        Sleep(100)
    WEnd
    MouseUp("left")
    HotKeySet("{NUMPAD1}", "m1")
EndFunc   ;==>m1

Func m3()
    HotKeySet("{NUMPAD3}")
    MouseDown("right")
    While _IsPressed(63)
        Sleep(100)
    WEnd
    MouseUp("right")
    HotKeySet("{NUMPAD3}", "m3")
EndFunc   ;==>m3

Func m2()
    $pos = MouseGetPos()
    MouseMove($pos[0], $pos[1] + $speed, 1)
EndFunc   ;==>m2

Func m4()
    $pos = MouseGetPos()
    MouseMove($pos[0] - $speed, $pos[1], 1)
EndFunc   ;==>m4

Func m6()
    $pos = MouseGetPos()
    MouseMove($pos[0] + $speed, $pos[1], 1)
EndFunc   ;==>m6

Func m8()
    $pos = MouseGetPos()
    MouseMove($pos[0], $pos[1] - $speed, 1)
EndFunc   ;==>m8

Func m7()
    $speed = $speed - 1
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m7

Func m9()
    $speed = $speed + 1
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m9

Func m5()
    If $speed = 10 Then
        $speed = 50
    Else
        $speed = 10
    EndIf
    TrayTip("Virtual Mouse", "You have set the mouse sensitivety to: " & $speed & " Pixels", 3)
EndFunc   ;==>m5

Func mdot()
    Switch $Disabled
        Case 0
            HotKeySet("{NUMPAD1}")
            HotKeySet("{NUMPAD3}")

            HotKeySet("{NUMPAD2}")
            HotKeySet("{NUMPAD4}")
            HotKeySet("{NUMPAD6}")
            HotKeySet("{NUMPAD8}")

            HotKeySet("{NUMPAD7}")
            HotKeySet("{NUMPAD9}")
            HotKeySet("{NUMPAD5}")
            TrayTip("Virtual Mouse", "You have disabled Virtual Mouse", 3)
            $Disabled = 1
        Case 1
            HotKeySet("{NUMPAD1}", "m1")
            HotKeySet("{NUMPAD3}", "m3")

            HotKeySet("{NUMPAD2}", "m2")
            HotKeySet("{NUMPAD4}", "m4")
            HotKeySet("{NUMPAD6}", "m6")
            HotKeySet("{NUMPAD8}", "m8")

            HotKeySet("{NUMPAD7}", "m7")
            HotKeySet("{NUMPAD9}", "m9")
            HotKeySet("{NUMPAD5}", "m5")
            TrayTip("Virtual Mouse", "Virtual Mouse is now Enabled", 3)
            $Disabled = 0
    EndSwitch
EndFunc   ;==>mdot
How? Needing "dll"?
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...