robot class not working
I need to make a macro with the robot class that draws a picture in a paint program. For each color in the image (256 colors total) it should change the paint color and drawing each 2x2 pixel that's that color. I made the program and it works correctly for about an hour, but then it starts slowing down a LOT, entering the wrong color codes, and drawing single pixels instead of 2x2.
Here is the code for changing the color:
robot.mouseMove (535, 504);
robot.mousePress (InputEvent.BUTTON1_MASK);
robot.mouseRelease (InputEvent.BUTTON1_MASK);
robot.mouseMove (568, 410);
robot.mousePress (InputEvent.BUTTON1_MASK);
robot.mouseRelease (InputEvent.BUTTON1_MASK);
robot.mousePress (InputEvent.BUTTON1_MASK);
robot.mouseRelease (InputEvent.BUTTON1_MASK);
for (i = 0; i < 6; i++)
{
robot.keyPress (color.toUpperCase ().charAt (i));
}
robot.keyPress (KeyEvent.VK_ENTER);
robot.keyRelease (KeyEvent.VK_ENTER);
Here is the code for drawing each pixel:
robot.mouseMove (415 + (w * 2), 185 + (h * 2) - 1);
robot.mousePress (InputEvent.BUTTON1_MASK);
robot.mouseMove (415 + (w * 2), 185 + (h * 2) + 1);
robot.delay (100);
robot.mouseRelease (InputEvent.BUTTON1_MASK);
Does anyone know why the robot stops working after about an hour?

