Custom Key Actions

Normally, when you list a key in a Keystroke Action, the system assumes that you want to press and release that key. A special variety of Keystroke Action is the Key Action, in which case the press and release of a key are performed separately. This allows you to do things like holding a modifier key down in Stage 1 when a button is pressed, and then releasing it in Stage 4 after a second press.

A Key Action consists of either “KeyDown” or “KeyUp” followed by a single keystroke (including optional modifiers) enclosed in parentheses. As with Button Actions, it is important that for each KeyDown you include a matching KeyUp later in the response. Otherwise, the key may be left in the down state.

Examples of Key Actions include:

KeyDown(Tab)

KeyUp(Tab)

KeyDown(Ctrl+Z)

KeyUp(Ctrl+Z)

KeyDown actions can have an additional attribute called Repeat. Repeat allows you to simulate the effect of holding a key down as you type. If this attribute is specified on the keystroke in a KeyDown action, then the keystroke will be repeated until either another KeyDown action is processed, or the KeyUp action for the given keystroke has been processed. As with modifier keys and other attributes, this option is used by placing the word “Repeat” and a “+” sign before the keystroke to be modified. For example:

1[KeyDown(Repeat+Z)];4[KeyUp(Z)]

CapsLock

The Caps Lock key can be used in all Keystroke Actions, including Key Actions, by inserting the word CapsLock (no space). It can be used either as a modifier or as a distinct keypress-but in either case, it functions as a toggle. Whichever state the Caps Lock key is in when you use CapsLock, it will switch to the opposite state. So in most cases you'll want to include CapsLock twice in a Button Response, once to turn it on and a second time to turn it off.

Example: This Button Response will toggle the Caps Lock key on or off each time the button is pressed (just like repeatedly pressing the Caps Lock key on your keyboard):

1[Keystroke(CapsLock)]

This is identical to:

1[KeyDown(CapsLock)];2[KeyUp(CapsLock)]

Example: This Button Response will type the word “GRAVIS” in all capital letters (assuming the Caps Lock key was OFF before the button was pressed) and then return the Caps Lock key to its previous state:

1[Keystroke(CapsLock.G.R.A.V.I.S.CapsLock)]

This is almost identical to the following (unless the Caps Lock key was already ON):

1[Keystroke(Shift+G.Shift+R.Shift+A.Shift+V.Shift+I.Shift+S)]

Note: The CapsLock command can also be used as a modifier key, as in Keystroke(CapsLock+A.B.C), but it still needs a second instance of CapsLock to return it to its previous OFF or ON state.

Extended

If an application does not respond properly to the arrow keys and other keys of the numeric keypad with num lock off, use the “Extended” keyword to make them look like the same keys in the extended group next to the numeric keypad. You can use the Extended keyword with Keystroke, KeyUp, and KeyDown Actions and the following keys:

Page Up

Up Arrow

Page Down

Right Arrow

End

Down Arrow

Home

Insert

Left Arrow

Delete

For example:

1[Keystrokes(Extended+Delete)]