Last active
June 23, 2023 06:27
-
-
Save whamtet/b1e1ab9370456ebf675810a3d9c39943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.time.LocalDateTime; | |
public class MouseMover { | |
public static final int PAUSE = 20000; | |
public static void main(String... args) throws Exception { | |
int limit = args.length == 0 ? 24 : Integer.parseInt(args[0]); | |
System.out.println("Time limit: " + limit); | |
Robot robot = new Robot(); | |
int increment = 1; | |
while (LocalDateTime.now().getHour() < limit) { | |
increment *= -1; | |
Point p = MouseInfo.getPointerInfo().getLocation(); | |
robot.mouseMove(p.x + increment, p.y + increment); | |
Thread.sleep(PAUSE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment