Skip to content

Instantly share code, notes, and snippets.

@bartoleo
Created May 26, 2014 14:33
Show Gist options
  • Save bartoleo/471a9d11bb2c73f49c41 to your computer and use it in GitHub Desktop.
Save bartoleo/471a9d11bb2c73f49c41 to your computer and use it in GitHub Desktop.
move mouse pointer to random position with Groovy
import java.awt.Robot
int SLEEP = 2000
int MAX_Y = 400
int MAX_X = 400
Robot robot = new Robot()
Random random = new Random()
println "Mouse Pointer under control"
while (true) {
println "moving Mouse Pointer"
robot.mouseMove(random.nextInt(MAX_X), random.nextInt(MAX_Y))
Thread.sleep(SLEEP)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment