Jump to content

Move the mouse with numpad?


Recommended Posts

I remember seeing a topic a while ago where someone made a program that would allow them to move their mouse with the Numpad. I did some searching but came up with nothing... I would just like to know if I'm even on a good start or how to start it. I understand the basics of what I want it to do.... I think.

$pos = MouseGetPos()
HotKeySet ("68", MouseMove ($pos[0]+1))
HotKeySet ("62", MouseMove ($pos[0]-1))
HotKeySet ("66", MouseMove ($pos[1]+1))
HotKeySet ("64", MouseMove ($pos[1]-1))

It is supposed to be running constantly and have the coords of the mouse pointer, it is then supposed to add or minus one on either the X or the Y axis depending on what numpad key I press and move the mouse there. What am I doing wrong?

Link to comment
Share on other sites

This was the post you are talking about... numpadMouse

I'm sure there are other maybe better ways of doing it as well... Sorry I'm eating lunch right now I'll come back and try to be of more specific help later

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

This was the post you are talking about... numpadMouse

I'm sure there are other maybe better ways of doing it as well... Sorry I'm eating lunch right now I'll come back and try to be of more specific help later

No problem. Thanks a lot man :)

Link to comment
Share on other sites

That seems like the long way.. Maybe give this a try

; Press Esc to terminate script
Global $Move = 5 ; Distance to move the mouse
Global $Speed = 0 ; How fast to move

HotKeySet("{ESC}", "Terminate")
HotKeySet("{NUMPAD8}", "ShowMe")
HotKeySet("{NUMPAD6}", "ShowMe")
HotKeySet("{NUMPAD2}", "ShowMe")
HotKeySet("{NUMPAD4}", "ShowMe")

While 1
    Sleep(100)
WEnd

Func ShowMe()
    $pos = MouseGetPos()
    If @HotKeyPressed = "{NUMPAD8}" Then MouseMove($pos[0], $pos[1] - $Move, $Speed)
    If @HotKeyPressed = "{NUMPAD6}" Then MouseMove($pos[0] + $Move, $pos[1], $Speed)
    If @HotKeyPressed = "{NUMPAD2}" Then MouseMove($pos[0], $pos[1] + $Move, $Speed)
    If @HotKeyPressed = "{NUMPAD4}" Then MouseMove($pos[0] - $Move, $pos[1], $Speed)
EndFunc   ;==>ShowMe

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

this will give you faster mouse movement (or more accurate (press num5)):

#include <Misc.au3>
$dll = DllOpen("user32.dll")
HotKeySet("{ESC}", "_Block_this_hotkey")
HotKeySet("{NUMPAD8}", "_Block_this_hotkey")
HotKeySet("{NUMPAD2}", "_Block_this_hotkey")
HotKeySet("{NUMPAD4}", "_Block_this_hotkey")
HotKeySet("{NUMPAD6}", "_Block_this_hotkey")
HotKeySet("{NUMPAD7}", "_Block_this_hotkey")
HotKeySet("{NUMPAD9}", "_Block_this_hotkey")
HotKeySet("{NUMPADADD}", "_Block_this_hotkey")
HotKeySet("{NUMPADSUB}", "_Block_this_hotkey")
HotKeySet("{NUMPAD5}", "_Set_Speed")
$speed = 0
TrayTip("NumPad -> Mouse", "Press Num2/4/6/8 for mouse movements" & @CRLF & _
        "Press Num7/9 for Mouse Left/Right click" & @CRLF & _
        "Press Num-/+ for mouse scroll In/Out" & @CRLF & _
        "Press Num5 to decrease/increase mouse speed movement" & @CRLF & _
        "Press Esc to exit", 20, 1)
func _Block_this_hotkey()
    ;blocked
EndFunc
func _Set_Speed()
    if $speed = 0 Then
        $speed = 1
        TrayTip("NumPad -> Mouse", "Speed set to: slow", 10, 1)
    Else
        $speed = 0
        TrayTip("NumPad -> Mouse", "Speed set to: fast", 10, 1)
    EndIf
EndFunc
While 1
    If _IsPressed("1B", $dll) Then
        DllClose($dll)
        Exit
    ElseIf _IsPressed("68", $dll) Then ;numpad8 -UP
        $pos = MouseGetPos()
        MouseMove($pos[0], $pos[1]-1, $speed)
    ElseIf _IsPressed("64", $dll) Then ;numpad4 -LEFT
        $pos = MouseGetPos()
        MouseMove($pos[0]-1, $pos[1], $speed)
    ElseIf _IsPressed("66", $dll) Then ;numpad6 -RIGHT
        $pos = MouseGetPos()
        MouseMove($pos[0]+1, $pos[1], $speed)
    ElseIf _IsPressed("62", $dll) Then ;numpad2 -DOWN
        $pos = MouseGetPos()
        MouseMove($pos[0], $pos[1]+1, $speed)
    ElseIf _IsPressed("67", $dll) Then ;numpad7 -Left Click
        MouseClick("Left")
        Sleep(100)
    ElseIf _IsPressed("69", $dll) Then ;numpad9 -Right Click
        MouseClick("Right")
        Sleep(100)
    ElseIf _IsPressed("6D", $dll) Then ;numpad- -Scroll In
        MouseWheel("up", 1)
    ElseIf _IsPressed("6B", $dll) Then ;numpad+ -Scroll Out
        MouseWheel("down", 1)
    EndIf
WEnd
Edited by sandin
Link to comment
Share on other sites

Here is my attempt:

#Include <Misc.au3>
$dll = DllOpen("user32.dll")

While 1
    
   $pos = MouseGetPos()
    
   If _IsPressed("68", $dll) Then
        MouseMove ($pos[0], $pos[1]-1)
    
   ElseIf _IsPressed("62", $dll) Then
        MouseMove ($pos[0], $pos[1]+1)
    
   ElseIf _IsPressed("66", $dll) Then
        MouseMove ($pos[0]+1, $pos[1])
    
  ElseIf _IsPressed("64", $dll) Then
        MouseMove ($pos[0]-1, $pos[1])
    
EndIf

    
Wend
Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
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...