move mouse cursor without point movement?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tatagi
Posts: 181
Joined: 23 Aug 2018, 11:17

move mouse cursor without point movement?

19 Nov 2023, 19:36

Code: Select all

^+a::
if WinExist("ahk_class Notepad")
{
WinClose
MouseGetPos, CoordXRec, CoordYRec
MouseMove, 1500, 1000, 0
MouseMove, %CoordXRec%, %CoordYRec%
}
else
Run, Notepad
return
what this does is, when I press ctrl + shift + a key combination, it checks if theres notepad app running and if yes, it closes the notepad app and move the cursor to 1500/1000 coordinates and return to its previous position.

it works. but it obviously looks ugly since you see the mouse pointer moving back and forth, distracting my eyes.

is there a way to prevent this completely or at least minimize this to almost nonvisible level?

thanks ;)
Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: move mouse cursor without point movement?

20 Nov 2023, 01:44

Hallo,
hide the cursor beforehand with SystemCursor(0) https://www.autohotkey.com/docs/v1/lib/DllCall.htm#HideCursor
and make it visible again afterwards with SystemCursor(1)
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: move mouse cursor without point movement?

20 Nov 2023, 12:26

Try:

Code: Select all

$1::SetCursorPos(1500,1000)

SetCursorPos(xPos,yPos) {
    DllCall("SetCursorPos", int, xPos, int, yPos)
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], macromint, peter_ahk and 331 guests