Skip to content

Instantly share code, notes, and snippets.

@lmorchard
Created January 25, 2019 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmorchard/e74cfaeee671ce32efdc995ef310dd2f to your computer and use it in GitHub Desktop.
Save lmorchard/e74cfaeee671ce32efdc995ef310dd2f to your computer and use it in GitHub Desktop.
Mouse tracking AutoHotKey script
; Key on mouse region change
!^+v::
ToolTip, start
SetTimer, CheckMouseRegion, 2000
return
!^+b::
ToolTip, stop
SetTimer, CheckMouseRegion, off
return
CheckMouseRegion:
CoordMode, Mouse, Screen
SysGet mon, Monitor
MouseGetPos, xpos, ypos
if (xpos >= monRight or ypos >= monBottom) {
return
}
isLeft := xpos < (monRight / 2)
isUpper := ypos < (monBottom / 2)
isCenter := xpos > (monRight * 0.3) and xpos < (monRight * 0.6) and ypos > (monBottom * 0.3) and ypos < (monBottom * 0.6)
if (isLeft = wasLeft) and (isUpper = wasUpper) and (isCenter == wasCenter) {
return
}
;if (isCenter) {
; ControlSend, ,{Numpad5}, ahk_exe obs64.exe
;} else
if (isLeft and isUpper) {
ControlSend, ,{Numpad7}, ahk_exe obs64.exe
} else if (not isLeft and isUpper) {
ControlSend, ,{Numpad9}, ahk_exe obs64.exe
} else if (isLeft and not isUpper) {
ControlSend, ,{Numpad1}, ahk_exe obs64.exe
} else if (not isLeft and not isUpper) {
ControlSend, ,{Numpad3}, ahk_exe obs64.exe
}
wasLeft := isLeft
wasUpper := isUpper
wasCenter := isCenter
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment