按钮标志的无效组合-使用机器人类

时间:2018-07-13 00:43:23

标签: awtrobot

我的代码:

for (int i = 0; i < 1000; i++) {
        robot.delay(900);
        if (robot.getPixelColor(160, 71).getRed() == 195) {
                    robot.mouseMove(160, 71);
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_MASK);
                    robot.delay(900);
                    robot.mousePress(KeyEvent.VK_R);
                    robot.mouseRelease(KeyEvent.VK_R);
                    robot.keyPress(KeyEvent.VK_9);
                    robot.keyRelease(KeyEvent.VK_9);
                    robot.delay(2100);
                    robot.keyPress(KeyEvent.VK_9);
                    robot.keyRelease(KeyEvent.VK_9);
            }
}

我的例外:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid combination of button flags
    at java.awt.Robot.checkButtonsArgument(Unknown Source)
    at java.awt.Robot.mousePress(Unknown Source)
    at genesis.com.br.Principal.<init>(Principal.java:84)
    at genesis.com.br.Principal.main(Principal.java:18)

它正在工作,但是现在不行,我不知道为什么,有人可以帮我吗? 谢谢!

0 个答案:

没有答案