Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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