A comprehensive toolkit for developing and debugging PyWinAuto scripts. This toolkit provides a graphical interface to help you identify windows, controls, and their properties, making it easier to create robust automation scripts.
- Process Explorer: View and attach to running processes
- Window Inspector: Identify windows and their properties
- Control Inspector: Explore UI controls within windows
- Code Generator: Automatically generate PyWinAuto code snippets
- Screenshot Tool: Capture screenshots of windows for documentation
- Application Logs: Record and analyze automation activities
- Ensure you have Python 3.6+ installed
- Clone or download this repository
- Install the required dependencies:
pip install -r requirements.txt
Run the launcher script to start the toolkit:
python launch_toolkit.py
The launcher will check for required dependencies and install them if needed.
Alternatively, you can run the toolkit directly:
python pywinauto_toolkit.py
- The Process Explorer tab shows all running processes
- Use the filter to find specific processes
- Double-click a process to view detailed information
- Click "Attach to Process" to connect to a process and view its windows
- Lists all visible windows on your system
- Select a window to view its properties
- Click "Highlight Window" to visually identify a window
- Click "Inspect Controls" to examine the controls within the window
- Click "Generate Window Code" to create PyWinAuto code for connecting to the window
- Shows the control hierarchy of the selected window
- Select a control to view its properties
- Click "Highlight Control" to visually identify a control
- Click "Generate Control Code" to create PyWinAuto code for interacting with the control
- Displays automatically generated PyWinAuto code
- Edit the code as needed
- Click "Copy to Clipboard" to copy the code
- Click "Save to File" to save the code to a Python file
- Click "Run Code" to execute the code and see the results
- Select a window from the dropdown
- Click "Capture" to take a screenshot of the window
- Click "Save Screenshot" to save the image to a file
- View logs of all automation activities
- Filter logs by level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Filter logs by category (WINDOW, CONTROL, PROCESS, SYSTEM, SCRIPT, USER)
- Search logs for specific text
- View detailed information about each log entry
- Save logs to JSON or text files for later analysis
- View statistics about log entries
The toolkit includes a comprehensive logging system that records all automation activities. This can be extremely helpful for debugging complex automation scripts.
- WINDOW: Window-related events (opening, closing, focusing)
- CONTROL: Control-related events (clicking, typing, selecting)
- PROCESS: Process-related events (starting, attaching)
- SYSTEM: System-related events (toolkit startup, shutdown)
- SCRIPT: Script-related events (code generation)
- USER: User-defined events
- DEBUG: Detailed information for debugging
- INFO: General information about normal operation
- WARNING: Potential issues that don't prevent operation
- ERROR: Errors that prevent specific operations
- CRITICAL: Critical errors that prevent the toolkit from functioning
- Run your automation script with the toolkit open
- Check the Application Logs tab for any errors or warnings
- Filter logs by category to focus on specific areas
- Use the search function to find specific events
- Save logs to a file for later analysis
- Use UIA backend: The toolkit uses the UIA backend by default, which provides better support for modern Windows applications.
- Wait for windows and controls: Always use
wait()methods to ensure windows and controls are ready before interacting with them. - Handle exceptions: Wrap your automation code in try/except blocks to handle unexpected situations.
- Use multiple identification methods: When identifying controls, try using multiple properties (control_type, title, automation_id) for more robust scripts.
- Test incrementally: Build and test your scripts in small increments to identify issues early.
- Window not found: Try using different identification properties or check if the window is minimized.
- Control not accessible: Some controls may require special handling or elevated permissions.
- Automation fails: Try adding delays or wait conditions to ensure the application is in the expected state.
If you encounter issues with the toolkit or PyWinAuto in general:
- Check the PyWinAuto documentation
- Look for similar issues on the PyWinAuto GitHub repository
- Use the PyWinAuto Toolkit to inspect the problematic window or control
This toolkit is provided under the MIT License. Feel free to modify and distribute it as needed.