L
L
Labunsky2019-08-28 16:35:31
Java
Labunsky, 2019-08-28 16:35:31

Why don't '[', ']' and some other keys work when awt.Robot simulates keystrokes on Windows XP, and how to deal with it?

There is a localized version of Windows XP. The robot refuses to press the [ ] keys; ' , / , throwing exceptions instead.
Physically, the keys are available, they are pressed. The layout is en_US. On later versions of Windows and Linux everything works correctly.
Code for testing:

Robot robot = new Robot();
for (int i = 0; i < 256; i++) {
        try {
            robot.keyPress(i);
            robot.delay(100);
            robot.keyRelease(i);
        } catch (IllegalArgumentException e) {
            System.out.println("Failed to press " + KeyEvent.getKeyText(i));
        }
}

Conclusion on XP

Failed to press Unknown keyCode: 0x0
Failed to press Unknown keyCode: 0x1
Failed to press Unknown keyCode: 0x2
Failed to press Unknown keyCode: 0x4
Failed to press Unknown keyCode: 0x5
Failed to press Unknown keyCode: 0x6
Failed to press Unknown keyCode: 0x7
Failed to press Unknown keyCode: 0xb
Failed to press Unknown keyCode: 0xd
Failed to press Unknown keyCode: 0xe
Failed to press Unknown keyCode: 0xf
Failed to press Kana
Failed to press Unknown keyCode: 0x16
Failed to press Unknown keyCode: 0x17
Failed to press Final
Failed to press Kanji
Failed to press Unknown keyCode: 0x1a
Failed to press Accept
Failed to press Mode Change
Failed to press Unknown keyCode: 0x29
Failed to press Unknown keyCode: 0x2a
Failed to press Unknown keyCode: 0x2b
Failed to press Comma
Failed to press Slash
Failed to press Unknown keyCode: 0x3a
Failed to press Semicolon
Failed to press Unknown keyCode: 0x3c
Failed to press Unknown keyCode: 0x3e
Failed to press Unknown keyCode: 0x3f
Failed to press Unknown keyCode: 0x40
Failed to press Open Bracket
Failed to press Close Bracket
Failed to press Unknown keyCode: 0x5e
Failed to press Unknown keyCode: 0x5f
Failed to press Unknown keyCode: 0x7c
Failed to press Unknown keyCode: 0x7d
Failed to press Unknown keyCode: 0x7e
Failed to press Dead Grave
Failed to press Dead Acute
Failed to press Dead Circumflex
Failed to press Dead Tilde
Failed to press Dead Macron
Failed to press Dead Breve
Failed to press Dead Above Dot
Failed to press Dead Diaeresis
Failed to press Dead Above Ring
Failed to press Dead Double Acute
Failed to press Dead Caron
Failed to press Dead Cedilla
Failed to press Dead Ogonek
Failed to press Dead Iota
Failed to press Dead Voiced Sound
Failed to press Dead Semivoiced Sound
Failed to press Unknown keyCode: 0x92
Failed to press Unknown keyCode: 0x93
Failed to press Unknown keyCode: 0x94
Failed to press Unknown keyCode: 0x95
Failed to press Ampersand
Failed to press Asterisk
Failed to press Double Quote
Failed to press Less
Failed to press Meta
Failed to press Unknown keyCode: 0x9e
Failed to press Unknown keyCode: 0x9f
Failed to press Greater
Failed to press Left Brace
Failed to press Right Brace
Failed to press Unknown keyCode: 0xa3
Failed to press Unknown keyCode: 0xa4
Failed to press Unknown keyCode: 0xa5
Failed to press Unknown keyCode: 0xa6
Failed to press Unknown keyCode: 0xa7
Failed to press Unknown keyCode: 0xa8
Failed to press Unknown keyCode: 0xa9
Failed to press Unknown keyCode: 0xaa
Failed to press Unknown keyCode: 0xab
Failed to press Unknown keyCode: 0xac
Failed to press Unknown keyCode: 0xad
Failed to press Unknown keyCode: 0xae
Failed to press Unknown keyCode: 0xaf
Failed to press Unknown keyCode: 0xb0
Failed to press Unknown keyCode: 0xb1
Failed to press Unknown keyCode: 0xb2
Failed to press Unknown keyCode: 0xb3
Failed to press Unknown keyCode: 0xb4
Failed to press Unknown keyCode: 0xb5
Failed to press Unknown keyCode: 0xb6
Failed to press Unknown keyCode: 0xb7
Failed to press Unknown keyCode: 0xb8
Failed to press Unknown keyCode: 0xb9
Failed to press Unknown keyCode: 0xba
Failed to press Unknown keyCode: 0xbb
Failed to press Unknown keyCode: 0xbc
Failed to press Unknown keyCode: 0xbd
Failed to press Unknown keyCode: 0xbe
Failed to press Unknown keyCode: 0xbf
Failed to press Back Quote
Failed to press Unknown keyCode: 0xc1
Failed to press Unknown keyCode: 0xc2
Failed to press Unknown keyCode: 0xc3
Failed to press Unknown keyCode: 0xc4
Failed to press Unknown keyCode: 0xc5
Failed to press Unknown keyCode: 0xc6
Failed to press Unknown keyCode: 0xc7
Failed to press Unknown keyCode: 0xc8
Failed to press Unknown keyCode: 0xc9
Failed to press Unknown keyCode: 0xca
Failed to press Unknown keyCode: 0xcb
Failed to press Unknown keyCode: 0xcc
Failed to press Unknown keyCode: 0xcd
Failed to press Unknown keyCode: 0xce
Failed to press Unknown keyCode: 0xcf
Failed to press Unknown keyCode: 0xd0
Failed to press Unknown keyCode: 0xd1
Failed to press Unknown keyCode: 0xd2
Failed to press Unknown keyCode: 0xd3
Failed to press Unknown keyCode: 0xd4
Failed to press Unknown keyCode: 0xd5
Failed to press Unknown keyCode: 0xd6
Failed to press Unknown keyCode: 0xd7
Failed to press Unknown keyCode: 0xd8
Failed to press Unknown keyCode: 0xd9
Failed to press Unknown keyCode: 0xda
Failed to press Unknown keyCode: 0xdb
Failed to press Unknown keyCode: 0xdc
Failed to press Unknown keyCode: 0xdd
Failed to press Quote
Failed to press Unknown keyCode: 0xdf
Failed to press Up
Failed to press Down
Failed to press Left
Failed to press Right
Failed to press Unknown keyCode: 0xe4
Failed to press Unknown keyCode: 0xe5
Failed to press Unknown keyCode: 0xe6
Failed to press Unknown keyCode: 0xe7
Failed to press Unknown keyCode: 0xe8
Failed to press Unknown keyCode: 0xe9
Failed to press Unknown keyCode: 0xea
Failed to press Unknown keyCode: 0xeb
Failed to press Unknown keyCode: 0xec
Failed to press Unknown keyCode: 0xed
Failed to press Unknown keyCode: 0xee
Failed to press Unknown keyCode: 0xef
Failed to press Unknown keyCode: 0xf6
Failed to press Unknown keyCode: 0xf7
Failed to press Unknown keyCode: 0xf8
Failed to press Unknown keyCode: 0xf9
Failed to press Unknown keyCode: 0xfa
Failed to press Unknown keyCode: 0xfb
Failed to press Unknown keyCode: 0xfc
Failed to press Unknown keyCode: 0xfd
Failed to press Unknown keyCode: 0xfe
Failed to press Unknown keyCode: 0xff

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question