SetStoreCapsLockMode

Whether to restore the state of the CapsLock key after sending simulated keystrokes.

PrevSetting := SetStoreCapsLockMode(Setting)

Parameters

Setting

Type: Boolean

If true, CapsLock state restoration is enabled, meaning the CapsLock key will be restored to its former state if key-sending functions such as Send or ControlSend needed to change it temporarily for its operation.

If false, CapsLock state restoration is disabled, meaning the state of the CapsLock key is not changed at all. As a result, key-sending functions will invert the case of the characters if the CapsLock key happens to be on during the operation.

Return Value

Type: Integer (boolean)

This function returns the previous setting; either 0 (false) for disabled or 1 (true) for enabled.

Remarks

By default, CapsLock state restoration is enabled. However, this does not guarantee that the CapsLock key will be turned off before sending keystrokes, nor that its previous state will be restored afterward.

SetStoreCapsLockMode is rarely used because the default behavior is best in most cases.

SetStoreCapsLockMode is ignored by Blind mode and Text mode; that is, the state of the CapsLock key is not changed in those cases.

The built-in variable A_StoreCapsLockMode contains the current setting and can also be assigned a new value instead of calling SetStoreCapsLockMode.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this function. That default may be changed by using this function during script startup.

SetCaps/Num/ScrollLockState, Send, ControlSend

Examples

Causes the state of the CapsLock key not to be changed at all.

SetStoreCapsLockMode False