Search code examples
python-3.xpywinautopyautogui

Send keyboard/mouse inputs with python macro keep target window background


I'm trying to make a macro program with python 3.7 on Windows10

I want to send keyboard/mouse inputs to any specific target window while the target window keep inactivated(minimized or background)

pyautogui seems to not be able to do that (If I miss something let me know plz)

pywinauto can send inputs to specific target window but it always make the target window activate.

Is there any way keeping target window inactivated????


import pywinauto

app = pywinauto.application.Application().connect(best_match='123 - Notepad', top_level_only=False, visible_only=False)

form = app.window(title_re='123 - Notepad')

for i in range(1, 10):
    form.type_keys("12e12e21e")

Solution

  • Remote Execution Guide -> Tricks to run automation on a locked machine