I want to automate desktop activities in Windows environment using Python. How it can be done? Some examples will also be helpful.
By desktop activities, I mean actions such as taking control over mouse and keyboard, access active windows properties, double-click on an icon on the desktop, minimize and maximize windows, enter data to an input popup window through keyboard, etc.
Steps to tackle this task,Install python and then pywinauto + pytest in your python environment (preferably in your own virtualenv) Launch your desktop app. Launch SWAPY and look at the list of apps it displays, watch for your app in that list.
pywinauto is a set of python modules to automate the Microsoft Windows GUI. At its simplest it allows you to send mouse and keyboard actions to windows dialogs and controls, but it has support for more complex actions like getting text data.
Python is a versatile language that can be used for various automation tasks. You can use Python for automating file or folder management, generating reports from data stored in a database, monitoring logs on your servers, creating website scrapers, among other things.
Have a look at SIKULI.
Sikuli is a visual technology to automate and test graphical user interfaces (GUI) using images (screenshots).
SIKULI uses a very clever combination of taking screenshots, and embedding them into your python (it's jython, actually) script.
Take screenshots:
and use them in your code:
You can try Automa.
It's a Windows GUI automation tool written in Python which is very simple to use. For example, you can do the following:
# to double click on an icon on the desktop doubleclick("Recycle Bin") # to maximize click("Maximize") # to input some text and press ENTER write("Some text", into="Label of the text field") press(ENTER)
The full list of available commands can be found here.
Disclaimer: I'm one of Automa's developers.
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