Instantly type in keyboard using JavaScript

124 views Asked by At

I'm currently developing a RPA application. I need to type a text in keyboard, but I need this process to be executed instantly (as if it were a copy and paste).

I've tried Nut.js and Robotjs but both of these have a delay between one key and another even if I configure the delay to 0ms or 1ms.

Someone know another automation library to make this process of typing immediate? Or should I try Python?

1

There are 1 answers

1
Ietu On BEST ANSWER

You could use the pyperclip library to first copy text using the pyperclip.copy() function and then use PyAutoGui library to paste the text. The pyperclip doesn't have a built-in function to paste but using both of these we can make it work.

Example:

import pyperclip
import pyautogui

#copy text to clipboard
text = "Testing the copy and paste"
pyperclip.copy(text)

#paste text from clipboard
pyautogui.hotkey('ctrl', 'v')