Looking for help with simulating keyboard press with Rstudio. My idea is to set my code to sys.sleep for some time and in meanwhile turn on the specific game (for example fifa or similar) and using Rstudio to simulate keyboard keys.
Want to train CNN / Q-learning process to manage to play a specific game in a mini situation.
Till now, checked this option in stack Overflow, but seems it's not working anymore.
One of the ideas, I had, is to use Rcpp package to implement C/C++ code in R. Founded one example how to simulate in C++, but so far I didn't manage to implement this code in Rcpp environment.
Any help would be really appreciated.
EDITED
My solution so far is to source Python code (tutorial in youtube):
from pynput.keyboard import Key, Controller
keyboard = Controller()
keyboard.press(Key.left)
keyboard.release(Key.left)
Save the code as "code.py", then on RStudio install "reticulate" package and source code in RStudio by:
system("python code.py")
Keys can be founded in youtube video (attached above).
Good day.
p.s. Working on Windows 10
There is a brand new R package KeyboardSimulator which is documented at
https://cran.r-project.org/web/packages/KeyboardSimulator/index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With