I am calling a Windows console application via python script. If the Windows console application exits with errors then the application prints "Press any key to continue" in the console. Now I would like to pass a random key press.
I have used keyboard.press_and_release()
, keyboard.write()
, pyautogui.press()
to send the random keypress. But these functions are sending the keys only after the complete python scripts ends, not after "Press any key to continue". If I press any key then the script ends and then a random key gets pressed with these functions. I want to avoid me pressing the key.
How can I do it?