1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public class Robot04{
public static void main(String[] args)
throws AWTException, IOException, InterruptedException{
Robot robot = new Robot();
Desktop.getDesktop().open(new File("c:\\windows\\system32\\calc.exe"));
Thread.sleep(2000); // Atends d'etre sur d'avoir calculatrice focused
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_6);
robot.keyRelease(KeyEvent.VK_6);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_MULTIPLY);
robot.keyRelease(KeyEvent.VK_MULTIPLY);
robot.keyPress(KeyEvent.VK_8);
robot.keyRelease(KeyEvent.VK_8);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
} |
Partager