I have tried using python libraries: pyautogui + pwinauto. But to no avail. Once the window is minimized the text is no longer send.
code snippet:
import pyautogui
import time
pyautogui.hotkey('win')
time.sleep(1)
pyautogui.typewrite('notepad')
pyautogui.hotkey('enter')
time.sleep(2)
pyautogui.typewrite('test aaaaaaaaaaaaaa bbbbbbbbbbbb cccccccccc ')
pywinauto can send text to a minimized window.
from pywinauto import Application
app = Application(backend="win32").start('notepad.exe')
app.UntitledNotepad.minimize()
app.UntitledNotepad.Edit.set_text('some text\nsecond line')
type_keys()
method requires a control to be in focus. But set_text
sends WM_SETTEXT
message by window handle, so focus is not required.
Another example of script dealing with minimized window: Python - Control window with pywinauto while the window is minimized or hidden
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With