Last active
August 22, 2023 12:13
-
-
Save MatteoGauthier/717282c1dcb46352ac10bff3b7ca6690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
from pynput.keyboard import Controller | |
keyboard = Controller() # Create the controller | |
def type_string_with_delay(string): | |
for character in string: # Loop over each character in the string | |
keyboard.type(character) # Type the character | |
delay = random.uniform(0, 2) # Generate a random number between 0 and 10 | |
time.sleep(delay) # Sleep for the amount of seconds generated | |
type_string_with_delay("This is my string typed with a delay") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment