Typing the same thing repeatedly can waste time and energy. Python automation lets you:
- Quickly test input fields
- Build bots or auto-responders
- Auto-fill forms or send bulk messages
- 🟢 Install pyautogui using:
pip install pyautogui
This will wait 5 seconds, type a message, and press Enter:
import pyautogui import time
print("Starting in 5 seconds...") time.sleep(5)
pyautogui.write("Hello, this is an automated message!") pyautogui.press('enter')
Hello, this is an automated message! is typed, then Enter is pressed.
This sends each message 3 times:
import pyautogui import time
messages = ["Subscribe to my channel", "Like this video", "Share with friends"]
print("Typing will start in 10 seconds...") time.sleep(10)
for message in messages: for _ in range(3): pyautogui.write(message) pyautogui.press('enter') time.sleep(0.5)
- Subscribe to my channel (3 times)
- Like this video (3 times)
- Share with friends (3 times)
This script types a custom sentence followed by "more" multiple times:
import pyautogui
import time
print("Typing will start in 15 seconds...")
time.sleep(15)
for i in range(1, 101):
pyautogui.write("create an image of relate to history")
pyautogui.press('enter')
time.sleep(11)
for _ in range(10):
pyautogui.write("more")
pyautogui.press("enter")
time.sleep(0.1)
time.sleep(16)
- 100 times: “create an image of relate to history”
- After each, it types "more" 10 times
- Send automatic WhatsApp replies
- Post replies in YouTube live chat
- Fill web forms automatically
- UI/keyboard testing
- Automate repetitive game chat
- ✅ Open the correct Notepad, browser, or terminal window where typing should happen.
- 🚫 Do not touch or click anywhere else once the countdown starts — the script types wherever the cursor is!
- 🛑 To stop the script immediately:
- 🔧 Use
Ctrl + C
in the terminal to cancel - ❌ Or simply close the terminal window or tab
- 🔧 Use
- Always use
time.sleep()
before the typing starts - Test with small loops before running large automations
- Use on empty Notepad or specific input box to avoid problems
Author: Only Python