R/R_Usage [Eng.]

Computer Task Automation with R program. "KeyboardSimulator"

Cha-Nyong 2022. 11. 2. 13:35

Hello,

There are several automation programs.

Ui.Path of Microsoft, Python, R, and Java etc..

Most of all, Ui.Path is only for automation program.

Ui.Path will be posted in the future, and today automation with R will be posted. 

 

 

Firstly, Install R program and RStudio.

Second, launch RStudio and install automation packages with command below.

The Package name is "KeyboardSimulator" 

 

##################### Install package ##########################

 

if (!require("devtools")) install.packages("devtools")

devtools::install_github("ChiHangChen/KeyboardSimulator")

install.packages("KeyboardSimulator")

 

###########################################################

 

 

Third, Launch Package

 

#################### Launch Package ########################

 

library(KeyboardSimulator)

 

#########################################################

 

Lastly, Let me introduce usage of KeyboardSimulator commands.

 

####################### Automation Commands ########################

 

#Keyboard

 

keybd.press("enter")

keybd.press("H+E+L+L+O")

keybd.press("ctrl+C")

 

keybd.press("Alt", hold = FALSE) #hold default is "FALSE", and "TRUE" means press with holding

keybd.press("Tab")

keybd.release("Alt") # Terminate holding of press

 

#Mouse

 

mouse.get_cursor() #Check mouse location 

mouse.move(425,700, duration = 0.5) #Migration the mouse cursur to 425, 700 location #duration is moving time

mouse.click("right") #Click the mouse #Default is left click and if type "right" it means right click

 

#Drag Mouse

 

mouse.click(, duration = 0.5, hold=TRUE)

mouse.move(, duration = 0.5)

mouse.release()

 

#Defence Error

 

Sys.sleep(1) # 1second sleep the system

#####################################################

 

 

 

 

#Example of automation

 

mouse.move(916,1053, duration = 0.5)

mouse.click()

mouse.move(401,527, duration = 0.5)

mouse.click()

mouse.move(610,234, duration = 0.5)

mouse.click()

keybd.press("z+h+e+l+d+d+d+h+f+b+d+m+l+a+h+e+m+s+r+j+t")

keybd.press("enter")

mouse.move(173,811, duration = 0.5)

mouse.click()

 

 

This explantion is moving the mouse cursur and operate keyboard.

This method is only for repeatable tasks in computor system.