Open Notepad App and Write Text into it Using Python 3, PyAutoGUI & pynput

In this tutorial, I’ll use Python 3, PyAutoGUI & pynput to open the Notepad app and write text into it.

pip install pyautogui
pip install pynput

code.py

import time
import os
import webbrowser
from pynput.keyboard import Key, Controller as K
from pynput.mouse import Button, Controller as M

os.startfile("notepad.exe")
M().position = (900,400)
M().click(Button.left, 1)
#time.sleep(3)
K().type('Hello world!')

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.