Skip to content

Instantly share code, notes, and snippets.

@pakoy3k
Created December 23, 2019 07:51
Show Gist options
  • Save pakoy3k/59de5123b16b17d3d46b8b1206df7da9 to your computer and use it in GitHub Desktop.
Save pakoy3k/59de5123b16b17d3d46b8b1206df7da9 to your computer and use it in GitHub Desktop.
import keyboard #pip install keyboard
import os
import time
import subprocess as sp
time.sleep(1)
osCommand = "notepad.exe"
filet = "file.txt"
sp.Popen([osCommand,filet])
time.sleep(2)
for i in range(0,10):
textoP = "Prueba de texto numero {0}\n".format(i)
keyboard.write(textoP)
time.sleep(.5)
keyboard.press("Alt+f")
time.sleep(1)
keyboard.press("s")
time.sleep(1)
keyboard.press("Alt+F4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment