Get Key State


This command saves the status of specific keys to a Boolean variable - true or false statement. In the example below we are checking the state of the CAPS lock key. The assumption is made that the CAPS Lock key is on. The result is saved to a Boolean variable. In this case the variable is named Key State. If the CAPS lock key is on, the Boolean variable stores a True value. If the Caps Lock key is off, the Boolean variable stores a False value.


Create If Statements based on the results to turn the CAPS lock key on if it isn't already, etc.



Script Editor > Expand Keyboard Category > Get Key State



Please select a keystate below:

Select one of eight key states from the drop down list. The keystate options are listed below:


Caps Lock is on

Scroll Lock is on

Num Lock is on

Shift is pressed

Ctrl is pressed

Alt is pressed

Left Win key is down

Right Win key is down



Save the result in the following variable:

Select or insert the variable that will store the value. The variable selected must be a Boolean variable.