SetCapsLockState()/SetNumLockState()/SetScrollLockState()

Auto Hotkey

SetCapsLockState/SetNumLockState/SetScrollLockState

Sets the state of the Capslock/NumLock/ScrollLock key. Can also force the key to stay on or off.

SetCapsLockState State
SetNumLockState State
SetScrollLockState State
Command  Example: SetScrollLockState "Off"
Function Example: SetScrollLockState("Off")

Parameters

State

If this parameter is omitted, the AlwaysOn/Off attribute of the key is removed (if present). Otherwise, specify one of the following words:

On or 1 (true): Turns on the key and removes the AlwaysOn/Off attribute of the key (if present).

Off or 0 (false): Turns off the key and removes the AlwaysOn/Off attribute of the key (if present).

AlwaysOn: Forces the key to stay on permanently.

AlwaysOff: Forces the key to stay off permanently.

Remarks

A key can also be toggled to its opposite state via the Send command; for example: Send {Capslock}.

Keeping a key AlwaysOn or AlwaysOff requires the keyboard hook, which will be automatically installed in such cases.

Related

SetStoreCapslockMode, GetKeyState

Examples

SetNumlockState, on
SetScrollLockState, AlwaysOff