Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.