Skip to content

Instantly share code, notes, and snippets.

@erikgregorywebb
Created February 1, 2021 03:22
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 erikgregorywebb/ff4648436f8f3500e1abfc827b1709d5 to your computer and use it in GitHub Desktop.
Save erikgregorywebb/ff4648436f8f3500e1abfc827b1709d5 to your computer and use it in GitHub Desktop.
# import
library(rJava)
library(rMouse)
Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_241') # for 64-bit version
# loop
condition = FALSE
while(condition == FALSE) {
Sys.sleep(30)
current_coordinates = rMouse::coord()
print(paste('X: ', current_coordinates$x, ' Y: ', current_coordinates$y))
new_x = current_coordinates$x + sample(-2:2, 1)
new_y = current_coordinates$y + sample(-2:2, 1)
rMouse::move(new_x, new_y, failSafe = FALSE)
}
print(Sys.time())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment