public class CreateUnicodeMap
extends java.lang.Object
This class can be used to map the default US English character map and then may be copied and\or modified to generate keycode character maps for other locales or languages. The generation of the US English map is already done and provided with the released package.
The class creates a file (SAFSKeycodeMap.dat) mapping text string sequences to the keycode used by the AWT Robot. For example:
The example shows that the literal text "ENTER" will be mapped to keycode integer 10. These keycodes are generally those defined in the java.awt.event.KeyEvent class.
SAFS text string sequences for commands like InputKeys are supported as follows. In general, these are the same strings used by IBM Rational Robot and Microsoft standards for defining keystrokes in scripting languages:
The following characters cause the associated keystroke to be performed:
~ Causes the Enter key to be pressed. + Causes the Shift key to be pressed and held down while the next character is pressed. ^ Causes the Control key to be pressed and held down while the next character is pressed. % Causes the Alt key to be pressed and held down while the next character is pressed.
If a group of characters is enclosed in parentheses, all the characters are affected by the special character that precedes the parentheses. For example, the following string inserts ABCD into the active window:
To insert one of the above special characters, that is, ~+^%({ as itself rather than as the special activity that it represents, enclose the character in curly braces. For example, the following command inserts a plus sign (+) into the active window:
Keytext value | Keyboard equivalent |
Actual printable character. Examples: A1.& | Letters A-Z, a-z, numbers 0-9, punctuation, other printable characters on the main keyboard. |
{Alt} | Default Alt key (either left or right). |
{BackSpace} {BS} {BkSp} | Backspace. |
{Break} | Break or Pause. |
{CapsLock} | Caps Lock. |
{Clear} | Clear. |
{Ctrl} | Default Control key (either left or right). |
{Delete} or {Del} or {NumDelete} or {ExtDelete} | Delete. |
{Down} or {NumDown} or {ExtDown} | Down Arrow. |
{End} or {NumEnd} or {ExtEnd} | End. |
{Enter} or ~ or {NumEnter} or {Num~} | Enter. |
{Escape} or {Esc} | Escape. |
{Help} | Help. |
{Home} or {NumHome} or {ExtHome} | Home. |
{Insert} or {NumInsert} or {ExtInsert} | Insert. |
{Left} or {NumLeft} or {ExtLeft} | Left Arrow. |
{NumLock} | Num Lock. |
{PgDn} or {NumPgDn} or {ExtPgDn} | Page Down. |
{PgUp} or {NumPgUp} or {ExtPgUp} | Page Up. |
{PrtSc} | Print Screen. |
{Right} or {NumRight} or {ExtRight} | Right Arrow. |
{ScrollLock} | Scroll Lock. |
{Shift} | Default Shift key (either left or right). |
{Tab} | Tab. |
{Space} | Space key. |
{ContextMenu} | ContextMenu key. |
{Up} or {NumUp} or {ExtUp} | Up Arrow. |
{Numn}, where n is a number from 0 through 9 Example: {Num5} | 0-9 (numeric keypad). |
{Num.} or . | . (period, decimal). |
{Num-} or - | - (dash, subtraction sign). |
{Num*} or * | * (asterisk, multiplication sign). |
{Num/} or / | / (slash, division sign). |
{Num+} or {+} | + (addition sign). |
{^} | ^ (caret character). |
{%} | % (percent character). |
{~} | ~ (tilde character). |
{(} | ( (left parenthesis character). |
) or {)} | ) (right parenthesis character). |
{{} | { (left brace character). |
} or {}} | } (right brace character). |
[ | [ (left bracket character). |
] | ] (right bracket character). |
{F#} Example: {F6} | F# (function keys 1-12). |
+ Example: +{F6} | Shift (used while pressing down another key). |
^ Example: ^{F6} | Control (used while pressing down another key). |
% Example: %{F6} | Alt (used while pressing down another key). |
{key n}, where key is any key, and n is the number of times that key is pressed. Example: {a 10} | Repeats the key press n number of times. |
Robot
,
KeyEvent
,
org.safs.staf.service.keys.InputKeysParser
,
RobotKeyEvent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALT |
static java.lang.String |
BRACELEFT |
static java.lang.String |
BRACERIGHT |
static java.lang.String |
CONTROL |
static java.lang.String |
DEFAULT_FILE
SAFSKeycodeMap
|
static java.lang.String |
DEFAULT_FILE_EXT
.dat
|
static java.lang.String |
ENTER |
static java.lang.String |
KEY_SPACE |
static java.lang.String |
PARENLEFT |
static java.lang.String |
PARENRIGHT |
static java.lang.String |
SHIFT |
static java.lang.String |
SPECIAL |
static java.lang.String |
STANDARD |
static java.lang.String |
TOKENS |
Constructor and Description |
---|
CreateUnicodeMap() |
Modifier and Type | Method and Description |
---|---|
static void |
addEntry(java.io.BufferedWriter outfile,
java.lang.String schar) |
static void |
addEntry(java.io.BufferedWriter outfile,
java.lang.String mapstring,
int keycode) |
static void |
addEntry(java.io.BufferedWriter outfile,
java.lang.String mapstring,
java.lang.String keycode) |
static java.lang.String |
getNewLine()
Return the current line separator used for file output.
|
static void |
main(java.lang.String[] args) |
static void |
output1(java.lang.String[] args) |
static void |
setNewLine(java.lang.String lineseparator)
Set a different file line separator.
|
public static final java.lang.String DEFAULT_FILE
public static final java.lang.String DEFAULT_FILE_EXT
public static final java.lang.String TOKENS
public static final java.lang.String STANDARD
public static final java.lang.String SPECIAL
public static final java.lang.String BRACELEFT
public static final java.lang.String BRACERIGHT
public static final java.lang.String PARENLEFT
public static final java.lang.String PARENRIGHT
public static final java.lang.String ALT
public static final java.lang.String CONTROL
public static final java.lang.String SHIFT
public static final java.lang.String ENTER
public static final java.lang.String KEY_SPACE
public static java.lang.String getNewLine()
public static void setNewLine(java.lang.String lineseparator)
lineseparator
- -- the String to use for line separation in the
output file.public static void addEntry(java.io.BufferedWriter outfile, java.lang.String mapstring, int keycode) throws java.io.IOException
java.io.IOException
public static void addEntry(java.io.BufferedWriter outfile, java.lang.String mapstring, java.lang.String keycode) throws java.io.IOException
java.io.IOException
public static void addEntry(java.io.BufferedWriter outfile, java.lang.String schar) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
public static void output1(java.lang.String[] args)
Copyright © SAS Institute. All Rights Reserved.