When you try to use Robot.keyPress to type a "
(double quotation mark) it throws a java.lang.IllegalArgumentException: Invalid key code.
How can I fix or get around this?
If it helps, I am currently on Windows.
Test code:
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class Test {
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
try {
robot.keyPress(KeyEvent.VK_QUOTEDBL);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Exception:
java.lang.IllegalArgumentException: Invalid key code
at sun.awt.windows.WRobotPeer.keyPress(Native Method)
at java.awt.Robot.keyPress(Robot.java:358)