I ran into a beautiful piece of code from @Lexikos, that enables me to toggle mouse acceleration (or pointer precision) by using a hotkey. Works flawlessly.
BUT Logitech driver causes Windows to reset the setting automatically on every startup.
Now is it possible to launch a script without a hotkey by putting a shortcut to the compiled .exe in the autostart folder? If yes, which piece of code do I have to use for this?
Mouse acceleration should be turned ON, maybe with a little MsgBox telling me that it's on now.
Thank you guys in advance!!
My code:
Code: Select all
WhatIsIt?:
SPI_GETMOUSE(accel, low, high)
MsgBox, , , Mouse acceleration settings`n accel:`t%accel%`n low:`t%low%`n high:`t%high%, 1
return
^NumpadAdd:: ; Enable acceleration.
^NumpadSub:: ; Disable acceleration.
SPI_SETMOUSE(A_ThisHotkey="^NumpadAdd") ; i.e. 1 if ^NumpadAdd, 0 otherwise.
gosub WhatIsIt?
return
^NumpadEnter:: ; Toggle acceleration.
if SPI_GETMOUSE(accel)
SPI_SETMOUSE(!accel)
;else an error occurred.
gosub WhatIsIt?
return
; Get mouse acceleration level and low/high thresholds.
; Returns true on success and false on failure.
SPI_GETMOUSE(ByRef accel, ByRef low="", ByRef high="")
{
VarSetCapacity(vValue, 12)
if !DllCall("SystemParametersInfo", "uint", 3, "uint", 0, "uint", &vValue, "uint", 0)
return false ; Fail.
low := NumGet(vValue, 0)
high := NumGet(vValue, 4)
accel := NumGet(vValue, 8)
return true
}
; Set mouse acceleration level and low/high thresholds.
; Supplies standard default values for low/high if omitted.
; fWinIni: 0 or one of the following values:
; 1 to update the user profile
; 2 to notify applications
; 3 to do both.
; Returns true on success and false on failure.
SPI_SETMOUSE(accel, low="", high="", fWinIni=0)
{
VarSetCapacity(vValue, 12)
, NumPut(accel
, NumPut(high!="" ? high : accel ? 10 : 0
, NumPut(low!="" ? low : accel ? 6 : 0, vValue)))
return 0!=DllCall("SystemParametersInfo", "uint", 4, "uint", 0, "uint", &vValue, "uint", 0)
}