Created
May 26, 2023 19:01
-
-
Save HoldYourWaffle/cf6d2b3b231edeb4f464f05c3af7c925 to your computer and use it in GitHub Desktop.
AutoHotkey - Clip cursor to rectangle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires AutoHotkey v2.0 | |
; Source for AHK v1: https://www.autohotkey.com/boards/viewtopic.php?p=445668&sid=dee54807a74853039237b72c90610eae#p445668 | |
ClipCursor(x := "", y := "", w := "", h := "") { | |
if p := x != "" { | |
VarSetStrCapacity(&RECT, 16) | |
p := StrPtr(RECT) | |
for k, v in [x, y, x + w, y + h] { | |
target := p + 4 * (k - 1) | |
NumPut("Int", v, target) | |
} | |
} | |
DllCall("ClipCursor", "Ptr", p) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment