0

so everything works fine without the os.system("Notepad") but when I add that it waits for me to close the application. But instead I wan't it to press the keys inside the notepad application. Any solutions?

import os
import keyboard
import time

list = [27, 1, 4, 21, 12, 20, 0, 19, 23, 9, 13, 29]
word = ""

for i in list:
    char = chr(ord('`') + i)
    if i == 27:
        word = word + "["
    elif i == 29:
        word = word + "]"
    elif i == 0:
        word = word + " "
    else:
        word = word + char
def split(word):
    return [char for char in word]
words = split(word)

os.system("Notepad")

for i in words:
    keyboard.press(i)
    time.sleep(.2)
Alp Durak
  • 25
  • 9

2 Answers2

1

If you replace the command with "start Notepad" it will start Notepad in a separate process :)

Adin Ackerman
  • 202
  • 1
  • 7
1

use "start notepad" and will run as separate process.

import os
import keyboard
import time
...
os.system("start Notepad")
...
for i in words:
    keyboard.press(i)
    time.sleep(.2)

``
George Imerlishvili
  • 1,816
  • 2
  • 12
  • 20