I want to make a Python script that automates the process of setting up a VPN server in Windows XP, but the only way I know how to do it is using the Windows GUI dialogs. How would I go about figuring out what those dialogs are doing to the system and designing a Python script to automate it?
6 Answers
You can try using Automa - it's a Windows automation tool which can be used as a python library:
from automa.api import *
And then you can use commands like start(..), click(..) and enter(..) which operate on UI. You can also use the tool as a standalone application, from its own console window. If a GUI element's name is not obvious, Automa offers a function called get_name_under_mouse() - you can hover your mouse over any GUI element to find out its name.
Disclosure: I'm involved in Automa's development
2 Comments
Take a look at SIKULI - there have been some reports of less-than-perfect operation in Windows but it is really simple to play around with and get a simple script up and running.
2 Comments
You could use SendKeys to send keystrokes to the dialogs in question, and a few extra tricks if you also need mouse actions.
Or, you could use StraceNT to monitor all the system calls made as you manually go through the dialogs, and reproduce them in Python with either the Python win32 extensions or ctypes.
2 Comments
Find out how to do what you want using commands (on the command line) and script these commands instead.
4 Comments
PyAutoGUI can be installed with pip from PyPI. It's cross platform and can control the mouse & keyboard. It has the features of pywinauto and a few more on top. It can't identify windows or GUI controls, but it does have basic screenshot & image recognition features to click on particular buttons. And it's well-documented and maintained.
pip install pyautogui