Language control the mouse and keyboard R
I want a simple web page and then slide like gadgets, but do not want to use python and selenium, a long time without a major are not familiar with, and then happened to find that page is as simple as a mouse click on it.
Looking for a long time, China did not say this package, then see google to see. This package is called KeyboardSimulator
, can be directly installed. Function is also simple.
mouse.get_cursor()
It is to get the current position of the mouse is located. Return value x, y
, is extracted. The return value is a vector.
mouse.move
It is moved to the specified coordinate position. Inside the main factor it is x
and y
, set up x
and y
you can move to the specified location.
mouse.click()
It is to click, which is the main factor, left-click or right-click. Hold it down or just click. (Look at the help
documentation on it.
If you have been holding down the left button or hold down the right, you can use mouse.release()
to pause.
Above all the mouse, there are keyboard
Keyboard operation is very simple: The main is to use the keybd.press()
function. For details, see the documentation, because too simple, this package will these functions.
keybd.press {KeyboardSimulator} R Documentation
Simulate Key Press
Description
Simulate keyboard key presses.
Multiple keys can be pressed simultaneously by using as separator (see Examples).
See keyboard_value for supported keys.
Usage
keybd.press(button, hold = FALSE)
Arguments
button
character. The key press to simulate (not case sensitive).
hold
logical. Whether the key should be held down.
If TRUE, the key can be released by pressing the phsical key on
the keyboard or by using the keybd.release function.
See Also
keybd.release
Examples
## Not run:
# press one key
keybd.press('a')
# press multiple keys
keybd.press('Alt F4')
# press multiple keys using hold
keybd.press('Alt', hold = TRUE)
keybd.press('F4')
keybd.release('Alt')
## End(Not run)
This package is very simple, specific description can look at this:
https://www.rdocumentation.org/packages/KeyboardSimulator/versions/2.1.0
Best to write about yourself, look at yourself