Skip to content

Instantly share code, notes, and snippets.

@Ovyerus
Last active December 1, 2018 02:33
Show Gist options
  • Save Ovyerus/95738f739acd7c6929755cb0d5cb79a8 to your computer and use it in GitHub Desktop.
Save Ovyerus/95738f739acd7c6929755cb0d5cb79a8 to your computer and use it in GitHub Desktop.
flip flop that cursor baby
; Constants
MOUSE_SWAP := 0x21
SET_CURSORS := 0x57
KEY_ORDER := ["Arrow","Help","AppStarting","Wait","Crosshair","IBeam","NWPen","No","SizeNS","SizeWE","SizeNWSE","SizeNESW","SizeAll","UpArrow","Hand"]
SCHEME = scheme name
; Generate scheme list
RegRead, SchemeList, HKEY_CURRENT_USER\Control Panel\Cursors\Schemes, % SCHEME,
SchemeList := StrSplit(SchemeList, ",")
COMBO::
; Swap mouse buttons
RegRead, Value, HKEY_CURRENT_USER\Control Panel\Mouse, SwapMouseButtons,
DllCall("SystemParametersInfo", "UInt", MOUSE_SWAP, "UInt", !Value, "UInt", 0, "UInt", "0")
RegWrite, REG_SZ, HKEY_CURRENT_USER\Control Panel\Mouse, SwapMouseButtons, % !Value
if (!SchemeList.MaxIndex()) {
Return
}
; Change cursor
if (!Value) {
RegWrite, REG_SZ, HKEY_CURRENT_USER\Control Panel\Cursors, , SCHEME
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Cursors, Scheme Source, 1
for i, v in KEY_ORDER {
RegWrite, REG_EXPAND_SZ, HKEY_CURRENT_USER\Control Panel\Cursors, % v, % SchemeList[i]
}
} else {
RegWrite, REG_SZ, HKEY_CURRENT_USER\Control Panel\Cursors, ,
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Cursors, Scheme Source, 0
for i, v in KEY_ORDER {
RegWrite, REG_EXPAND_SZ, HKEY_CURRENT_USER\Control Panel\Cursors, % v
}
}
DllCall("SystemParametersInfo", "UInt", SET_CURSORS, "UInt", 0, "UInt", 0, "UInt", "0")
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment