Send Keys To A Inactive Window In Python
I'm trying to press a key in another process from a Python program. I've tried the win32 api, but somehow this code does nothing: import win32gui import win32con import win32api h
Solution 1:
Use (but add error checking)
hwndMain = win32gui.FindWindow("notepad", "prueba.txt: Bloc de notas")
hwndEdit = win32gui.FindWindowEx( hwndMain, 0, "Edit", 0 )
win32api.PostMessage( hwndEdit,win32con.WM_CHAR, ord('x'), 0)
you should add some "sleep" calls if you want to loop posting message :-)
Post a Comment for "Send Keys To A Inactive Window In Python"