Win Automation Tool
This project contains a Python module win32_gui_utils that provides utilities for interacting with Windows GUI elements using the win32 API.
Features
- Find windows by name
- Get handles for controls within windows
- Simulate mouse clicks (left and right)
- Retrieve and set text in controls
- Wait for controls to be ready for interaction
- Get properties of controls within a window
- Select items in ComboBoxes
- Focus windows
Dependencies
- pywin32: Provides access to Windows APIs (win32gui, win32con, win32api)
- time, ctypes: Standard Python modules for time control and buffer manipulation
Usage
Here's a basic example of how to use some of the functions:
import win32_gui_utils as wgu
# Find a window
window_handle = wgu.find_window("Notepad")
# Get a control within the window
edit_handle = wgu.get_handle_by_id(window_handle, 15)
# Write text to the control
wgu.write_text(edit_handle, "Hello, World!")
# Click a button
button_handle = wgu.get_handle_by_id(window_handle, 1)
wgu.click_button(button_handle)
Main Functions
find_window(window_name, max_attempts=3, wait_time=2): Locates a window by its name (title)get_handle_by_id(hwnd, target_id): Gets the handle of a control specified by ID within a windowwait_for_control(hwnd, target_id, timeout=10, poll_interval=0.5): Waits for a control to be ready for interactionclick_button(hex_handle): Simulates a mouse click on a controlwrite_text(hex_handle, text): Sends a text string to a controlget_control_properties(parent_handle): Collects properties of child controls of a specified windowselect_combo_item(combo_hwnd, index): Selects an item in a ComboBox by indexfocus_window(hwnd): Sets a window as active (focused)
For more detailed information about each function, please refer to the docstrings in the source code.
Note
This module is designed for Windows automation tasks and requires appropriate permissions to interact with system windows and controls. Use responsibly and ensure you have the necessary rights to automate the target applications.
Metadata
Release files for win32-gui-utils 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| win32_gui_utils-0.0.3.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| win32_gui_utils-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / win32_gui_utils-0.0.3.tar.gz
| Download URL | win32_gui_utils-0.0.3.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2954e5b03e0c2fa8d7a48225856597230beb8dd9b2f824ef9ae124571ff1f1ee
|
|
BLAKE2b-256 checksum How to use checksums |
7f0aa3cbe5bf2b320db6d4aa5c338279219f62c5ca448b74d412f44c16ec2f1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Release files / win32_gui_utils-0.0.3-py3-none-any.whl
| Download URL | win32_gui_utils-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
845d56adb503d14ae7e2ca05f16c74fda933e53c9b50e57ab05a8e1004b228b3
|
|
BLAKE2b-256 checksum How to use checksums |
d2caba64c7c89a019fb87879891b265304528b434ec20a58547c2323f7f68d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|