Hey there using this code snippet:
try {
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_H);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyPress(KeyEvent.VK_O);
robot.keyRelease(KeyEvent.VK_O);
} catch (AWTException e) {
e.printStackTrace();
}
i get this result :
hallo
But is there any way to shorten this process ? e.g. something like:
try {
Robot robot = new Robot();
String word = "hallo";
// something like:
robot.keyPress(KeyEvent.word);
} catch (AWTException e) {
e.printStackTrace();
}
I know this example doesn't work, but I couldn't find any documentation about this.
You have any ideas? greetings and thanks