Skip to content

Instantly share code, notes, and snippets.

@reflexdemon
Last active April 20, 2022 12:52
Show Gist options
  • Save reflexdemon/85a0b41ad5bb41e18f207c1b56f47e84 to your computer and use it in GitHub Desktop.
Save reflexdemon/85a0b41ad5bb41e18f207c1b56f47e84 to your computer and use it in GitHub Desktop.
Robo Sleep
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