Hello,
I've used different mouse functions that worked fine and in a very straight forward way of simply moving the mouse to a set of absolute coordinates on the screen. But for some reason, as soon as I use DLLCall mouse_event, the mouse cursor, regardless of what the target coordinates are, just bounces around from one corner to the other. Even if I set the coordinates all to the same 1280,720, which in theory would mean the mouse cursor would remain stationary, it still continues to bounce around. Any help on this would be appreciated.
I've used different mouse functions that worked fine and in a very straight forward way of simply moving the mouse to a set of absolute coordinates on the screen. But for some reason, as soon as I use DLLCall mouse_event, the mouse cursor, regardless of what the target coordinates are, just bounces around from one corner to the other. Even if I set the coordinates all to the same 1280,720, which in theory would mean the mouse cursor would remain stationary, it still continues to bounce around. Any help on this would be appreciated.
CODE:
; Function to move the mouse cursor to a specific position on the screen
MoveMouseToAbsolute(x, y) {
; Get the current mouse position
MouseGetPos, startX, startY
; Calculate the distance to move
dx := x - startX
dy := y - startY
; Move the mouse using mouse_event function
DllCall("mouse_event", UInt, 1, Int, dx, Int, dy, UInt, 0, UInt, 0)
; Show tooltip with current and target coordinates
Tooltip, Target coordinates:`nX: %x%`nY: %y%
; Sleep to allow time for the mouse cursor to move (adjust as needed)
Sleep 1000
; Clear tooltip
Tooltip
}
; Example: Move mouse to several positions
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
Sleep 1000
MoveMouseToAbsolute(1280, 720)
; Hotkeys for Control
Pause:: Pause
^Esc:: ExitApp
Statistics: Posted by prototype_zero — Today, 15:55