![]() |
Is there any way to simulate clicks/typing to an inactive window using Python? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Is there any way to simulate clicks/typing to an inactive window using Python? (/thread-10866.html) |
Is there any way to simulate clicks/typing to an inactive window using Python? - Nwb - Jun-11-2018 By the way, I'm a windows user. A lot of windows-automation scripting programs have this function (although not always effective) so I was wondering if it can be implemented in Python, or I will have to collaborate two scripts from two different languages. Also do note that I am a complete newbie to programming itself so I won't understand any technical terms, in fact I have not even read most of the tutorial (from docs) yet (yes I'm lazy. So I would appreciate if you give more context like a brief description and suggestions. Also, would it also be possible to do this on Mac? And since we're at it, would it also be possible in Android and IOS? Anyways, I appreciate that you read the thread. ![]() RE: Is there any way to simulate clicks/typing to an inactive window using Python? - Larz60+ - Jun-11-2018 Here's one way: first install https://pypi.org/project/PyAutoGUI/ use: pip install PyAutoGUIthen to emulate a mouse click: import pyautogui pyautogui.click()You can look at the source to see how it's done. If this is being used in response to an interactive query, you might want to examine expect: https://github.com/sumeet/expect expect was written by Don Libes of NIST and has been around (for 'C') for a long time. Great for automating demos. This can be installed with pip as well |