Reputation: 63
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")
Upvotes: 3
Views: 3062
Reputation: 63
I found the answer!!!!
app = Application(backend="win32").connect(process=12345)
form = app.window(title_re="windowtitle")
form.send_keystrokes("1234567")
Upvotes: 3
Reputation: 9991
Remote Execution Guide -> Tricks to run automation on a locked machine
Upvotes: 1