Skip to content

Instantly share code, notes, and snippets.

@harpocrates
Created March 4, 2020 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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