#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
Opt("MouseCoordMode",1)
; Press Esc to terminate script, Pause/Break to "pause"
Global Const $WH_KEYBOARD_LL = 13
Global $g_bPaused = False
Global $sBuffer = ""
Global $hStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")
Global $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", _
$WH_KEYBOARD_LL, "ptr", DllCallbackGetPtr($hStub_KeyProc), "hwnd", $hMod[0], "dword", 0)
HotKeySet("{ESC}", "OnAutoItExit")
HotKeySet("{NUMPAD8}", "MUp")
HotKeySet("{NUMPAD2}", "MDown")
HotKeySet("{NUMPAD4}", "MLeft")
HotKeySet("{NUMPAD6}", "MRight")
While 1
Sleep(100)
WEnd
Func MLeft()
MouseMovePlus(-30, 0)
EndFunc
Func MRight()
MouseMovePlus(30, 0)
EndFunc
Func MUp()
MouseMovePlus(0, -30)
EndFunc
Func MDown()
MouseMovePlus(0, 30)
EndFunc
Func Terminate()
EndFunc ;==>Terminate
Func MouseMovePlus($X, $Y,$absolute = 0)
Local $MOUSEEVENTF_MOVE = 0x1
DllCall("user32.dll", "none", "mouseevent", _
"long", $MOUSEEVENTF_MOVE, _
"long", $X, _
"long", $Y, _
"long", 0, _
"long", 0)
MouseMove(MouseGetPos()[0]+$X,MouseGetPos()[1]+$Y)
DllCall("SetCursorPos", "int",MouseGetPos(0)+$X,"int",MouseGetPos(1)+$Y)
ToolTip (MouseGetPos(0)&"-"& MouseGetPos(1))
EndFunc
Func OnAutoItExit()
If $hStub_KeyProc Then DllCallbackFree($hStub_KeyProc)
$hStub_KeyProc = 0
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook[0])
If @HotKeyPressed <> "" Then Exit
EndFunc