Last active
April 20, 2022 12:52
-
-
Save reflexdemon/85a0b41ad5bb41e18f207c1b56f47e84 to your computer and use it in GitHub Desktop.
Robo Sleep
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.util.*; | |
/** | |
* Robo Sleep | |
*/ | |
public class SleepSwitch { | |
public static void main(String[] args) throws Exception { | |
Robot hal = new Robot(); | |
Random random = new Random(); | |
while (true) { | |
PointerInfo pointInfo = MouseInfo.getPointerInfo(); | |
Point point = pointInfo.getLocation(); | |
int oldX = (int) point.x; | |
int oldY = (int) point.y; | |
int x = Math.abs(random.nextInt() % 640); | |
int y = Math.abs(random.nextInt() % 480); | |
hal.mouseMove(x, y); | |
hal.mouseMove(oldX, oldY); | |
System.out.printf("Setting Old Mouse at %d, %d Setting Mouse at %d, %d\n", oldX, oldY, x, y); | |
hal.delay(1000 * 10); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment