Skip to content

Instantly share code, notes, and snippets.

@jnsdbr
Created June 11, 2015 21:26
Show Gist options
  • Save jnsdbr/2f48691615d8e65896b6 to your computer and use it in GitHub Desktop.
Save jnsdbr/2f48691615d8e65896b6 to your computer and use it in GitHub Desktop.
import java.awt.event.*;
import java.awt.Robot;
Robot bot = null;
int nextClick = (int)random(15, 50);
void setup() {
try {
bot = new Robot();
}
catch (Exception failed) {
System.err.println("Failed instantiating Robot: " + failed);
}
}
void draw() {
if(frameCount > nextClick)
{
nextClick = frameCount + (int)random(15, 50);
click();
}
}
void click() {
int mask = InputEvent.BUTTON1_DOWN_MASK;
bot.mousePress(mask);
bot.mouseRelease(mask);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment