Key Constants
Applicable usage situations for these predefined constants of special keys and key
modifiers can be found in Acting on a Region and Low
Level Mouse and Keyboard Actions
Special Keys
Section titled “Special Keys”The methods supporting the use of special keys are
type() <Region.type>,keyDown() <Region.keyDown>keyUp() <Region.keyUp>.
Usage: Key.CONSTANT
(where CONSTANT is one of the following key names, uppercase mandatory).
String concatenation with with other text or other key constants is possible using “ + .
type("some text" + Key.TAB + "more text" + Key.TAB + Key.ENTER)# or eqivalenttype("some text\tmore text\n")miscellanous keys
ENTER, TAB, ESC, BACKSPACE, DELETE, INSERTmiscellanous keys
SPACEfunction keys
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15navigation keys
HOME, END, LEFT, RIGHT, DOWN, UP, PAGE_DOWN, PAGE_UPspecial keys
PRINTSCREEN, PAUSE, CAPS_LOCK, SCROLL_LOCK, NUM_LOCKNote: The status ( on / off ) of the keys Key.CAPS_LOCK, Key.NUM_LOCK and Key.SCROLL_LOCK can
be evaluated with the method Env.isLockOn() <Env.isLockOn>.
numpad keys
NUM0, NUM1, NUM2, NUM3, NUM4, NUM5, NUM6, NUM7, NUM8, NUM9SEPARATOR, ADD, MINUS, MULTIPLY, DIVIDEKey Modifiers (modifier keys)
Section titled “Key Modifiers (modifier keys)”modifier keys
ALT, CMD, CTRL, META, SHIFT, WIN, ALTGRA key is called a modifier key, when it is used in conjunction with other keys by pressing and holding it while typing the other keys. The keys used most commonly as modifier keys are SHIFT, ALT (left alt key, CTRL (might be strg on Windows) and the CMD key (Apple key on OS X). On Windows you additionally have the Windows key and the alt key on the right.
the plain type() <Region.type> command has 2 parameters:
- parameter 1: the keys, that should be pressed/released one after the other
- parameter 2: the modifier keys, that alltogether should be pressed and held during the typing and released at the end.
For parameter 2 there are 2 options:
- new version: (a key is a key ;-):
Key.XXX- old version (kept for upwards compatibility):
KeyModifier.XXX
- old version (kept for upwards compatibility):
… and these early versions should not be used anymore
KEY_ALT, KEY_CTRL, KEY_SHIFT, KEY_WIN, KEY_CMD, KEY_META
The modifier keys can be combined using “ + , if more than one key modifier is needed.
# example with the recommended Key.XXX versiontype(Key.ESC, Key.CTRL + Key.ALT)Note for Java programming:
These constants are mapped to the according constants of java.awt.event.InputEvent.