Reputation: 1
I just started learning python and I have made this script that types for me, but I couldn't figure out how to make it press the enter key.
import time
keyboard = Controller()
time.sleep(3)
for char in "Hello, this isn't notking but this is a bot, he has been learning python and learned this script that types for him!":
keyboard.press(char)
keyboard.release(char)
time.sleep(0.12)```
Upvotes: 0
Views: 122
Reputation: 119
This should help you with your problem. Next time please provide the whole code related to the question.
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
time.sleep(3)
for char in "Hello, this isn't notking but this is a bot, he has been learning python and learned this script that types for him!":
keyboard.press(char)
keyboard.release(char)
time.sleep(0.12)
keyboard.press(Key.enter)
keyboard.release(Key.enter)
Upvotes: 1