Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Awt Robot changes Windows Mouse Speed

Every time I use Robot to move the mouse, it resets the Windows mouse speed. This is really annoying to deal with, and I was wondering if anyone knows how to fix this. Here is basically the code I am messing around with:

Robot robot = new Robot();
robot.mouseMove(10, 1070);
robot.delay(300);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.delay(300);
robotType("notepad");
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.delay(400);
robotType("I am writing this.");

What this does is essentaily click the start button, type "notepad", open notepad, then types "I am writing this".

robotType() is just a quick function I made that converts a string into a series of keyboard presses/releases.

like image 513
yathern Avatar asked Apr 03 '12 02:04

yathern


1 Answers

This would appear to be a windows bug, as nothing you have done inherently alters the mouse speed. It seems you may be out of luck...

like image 73
Atlas Wegman Avatar answered Oct 18 '22 21:10

Atlas Wegman