Skip to content

Instantly share code, notes, and snippets.

@harpocrates
Created March 4, 2020 03:58
Show Gist options
  • Save harpocrates/f73946d4a319f3c78b7316186ab6708d to your computer and use it in GitHub Desktop.
Save harpocrates/f73946d4a319f3c78b7316186ab6708d to your computer and use it in GitHub Desktop.
Script for AFK-ing clicking πŸ˜›
import java.awt.event.InputEvent
def rightClickUntilMouseMove(setupMillis: Int, everyMillis: Int): Unit = {
Thread.sleep(setupMillis)
val pInit = MouseInfo.getPointerInfo().getLocation
while (pInit == MouseInfo.getPointerInfo().getLocation) {
val r = new Robot()
r.mousePress(InputEvent.BUTTON3_MASK)
r.mouseRelease(InputEvent.BUTTON3_MASK)
Thread.sleep(everyMillis)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment