Skip to content

Instantly share code, notes, and snippets.

@dbdness
Last active November 14, 2023 13:56
Show Gist options
  • Save dbdness/eb8480192270a08a0169a0e0599b69bd to your computer and use it in GitHub Desktop.
Save dbdness/eb8480192270a08a0169a0e0599b69bd to your computer and use it in GitHub Desktop.
AutoHotKey script for bringing the cursor back to last known position (for example on main, external monitor) after touch event on occurs on another display (for example on sidecar laptop with touch screen).
;~Check mouse position every second.
SetTimer, MousePos, 1000
MousePos:
MouseGetPos, x, y
return
~LButton::
TimeL := A_TickCount
Return
~LButton Up::
Time := A_TickCount - TimeL
xp := x + Abs(x)+1 + (1920 - Abs(x))
If (Time < 20){
if (x < 0){
MouseMove, %xp%, %y%
} else {
MouseMove, %x%, %y%
}
}
Return
@dbdness
Copy link
Author

dbdness commented Nov 14, 2023

All credits for first edition of the script goes to https://superuser.com/a/1779188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment