Reputation: 99
So I am trying to mimic human typing best as possible. Right now I am using pyautogui.typewrite("what i want to type") to type and it is basically pasting it, is there anyway i can get it to maybe type the letters one by one but in a quick manner?
Upvotes: 1
Views: 564
Reputation:
In order to mimic human typing as best as possible you need to study human (for example your own) typing first creating a database of "time distances" between the strokes of single keys within different words and use this database for setting the time.sleep(timeDistance)
in the for e in text:
loop (see the answer by ᴡʜᴀᴄᴋᴀᴍᴀᴅᴏᴏᴅʟᴇ3000).
Another approach to understand how to mimic human typing as best as possible is to try to write an own detector of automated typing. Humans tend to repeat given patterns of own typing behavior with "time distances" between given combinations of keystrokes that don't vary by chance (hence the need for a database depending on the keystroke sequences).
Upvotes: 1
Reputation: 6748
Try a loop
import pyautogui
import time
text="what i want to type"
for e in text:
pyautogui.typewrite(e)
time.sleep(.1) #change this value to whatever you mean by "a quick manner"
Upvotes: 1