Please help me to get this work with Ctrl key instead? Thank you very much!!
Code: Select all
; Example: This is a hotkey that temporarily reduces the mouse cursor's speed, which facilitates precise positioning.
; Hold down F1 key to slow down the cursor. Release it to return to original speed.
F1::
SPI_GETMOUSESPEED = 0x70
SPI_SETMOUSESPEED = 0x71
; Retrieve the current speed so that it can be restored later:
DllCall("SystemParametersInfo", UInt, SPI_GETMOUSESPEED, UInt, 0, UIntP, OrigMouseSpeed, UInt, 0)
; Now set the mouse to the slower speed specified in the next-to-last parameter (the range is 1-20, 10 is default):
DllCall("SystemParametersInfo", UInt, SPI_SETMOUSESPEED, UInt, 0, Ptr, 3, UInt, 0)
KeyWait F1 ; This prevents keyboard auto-repeat from doing the DllCall repeatedly.
return
F1 up::DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, Ptr, OrigMouseSpeed, UInt, 0) ; Restore the original speed.