Autohotkey ... modifying the mouse/touchpad pointer speed?

Is there any way (using autohotkey or not) to create a shortcut (two, actually) for modifying the mouse/touchpad pointer speed ?

I have two mices, and one touchpad, which I use alternatively ... and every one of them somehow differently sets its pointer speed. In any case, very annoying. I also, sometimes would like to have touchpad at a greater speed, depending on what I'm doing at the moment.

So, does anyone know how that could be accomplished ? All ideas on the subject welcomed.


Solution 1:

The registry key is loated in HKEY_CURRENT_USER\Control Panel\Mouse\MouseSensitivity but modifying this through AutoHotkey alone usually doesn't work. The best way is to use a DLL call:

^+u::DllCall("SystemParametersInfo", Int,113, Int,0, UInt,20, Int,2) ;high sensitivity
^+d::DllCall("SystemParametersInfo", Int,113, Int,0, UInt,5, Int,2) ;low sensitivity
^+n::DllCall("SystemParametersInfo", Int,113, Int,0, UInt,10, Int,2) ;normal sensisivity

Ctrl + Shift + u sets sensitivity to high, Ctrl + Shift + d sets it low, and Ctrl + Shift + n sets it back to default. Edit this script to your hearts content.

But, what you could use the registry for is querying the current value, so you can increment the speed by 1 like so:

^+u::
RegRead, MyVar, HKEY_CURRENT_USER, Control Panel\Mouse,MouseSensitivity
if (MyVar == 20)
{
    MsgBox Value is already at max
    Exit, 0
}
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,%MyVar%+1, Int,2)
return

Solution 2:

See if this AutoHotKey forum thread helps you: Adjusting Mouse Sensitivity via hotkey