Automatic writing using Java
Code show below
<----------------------------------------------------------------------------------------------------------->
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class RobotKeyboardEvent {
public static void main(String[] args) {
try {
Robot robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_H);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_E);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_L);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_L);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_O);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_SPACE);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_W);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_O);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_R);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_L);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_D);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment