pywinauto
БесплатноБез исполняемых скриптовНе проверенDrives Windows desktop applications from Python by finding windows and controls and clicking, typing and reading them through the Win32 or UI Automation…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
pywinauto — Scripted control of Windows desktop apps
Overview
pywinauto finds windows and controls of a running Windows program and drives them: it reads their text, sets values, invokes buttons, selects menu items and sends real keystrokes and mouse clicks. It has two backends. win32 (the default) works through window handles and suits classic Win32/MFC/VB/Delphi programs. uia uses Microsoft UI Automation and suits WPF, WinForms, Qt, UWP/WinUI and most modern apps.
This skill was written from the stable release 0.6.9 (PyPI, January 2025): its installed source and signatures, plus the repository metadata. The machine used for writing was Linux, where the library imports but cannot drive anything, so no automation code below was executed; treat each snippet as documentation-checked and run it on a Windows test machine first. PyPI also carries 1.0.0b1 (a pre-release published in October 2026, installed only with pip install --pre); it is not covered here. The project is maintained but slow: the previous stable release before 0.6.9 was in 2019.
Instructions
Installation
py -m venv .venv
.venv\Scripts\pip install pywinauto
.venv\Scripts\python -c "import pywinauto; print(pywinauto.__version__)"
It pulls in pywin32 and comtypes on Windows. Run scripts in the same interactive desktop session as the target app; a service, a locked screen or a disconnected remote-desktop session breaks input-based actions. If the target runs as administrator, run Python as administrator too, otherwise UI Automation cannot reach it.
Start or connect
from pywinauto import Application
app = Application(backend="uia").start("notepad.exe") # launch
app = Application(backend="uia").connect(title_re=".*Notepad$") # attach to a running window
app = Application(backend="win32").connect(path="notepad.exe") # by executable path
app = Application(backend="uia").connect(process=4128) # by PID
connect() accepts one of process, handle, path, or the window criteria below (title, title_re, class_name, ...), plus timeout. start(cmd_line, timeout=None, work_dir=None, wait_for_idle=True) takes the whole command line as one string. Close with app.kill().
Packaged (UWP/Store) apps and apps whose launcher exits right away do not leave a process that start() can follow. Start them any way you like, then find the window with Desktop:
from pywinauto import Desktop
win = Desktop(backend="uia").window(title_re=".*Calculator$")
win.wait("ready", timeout=15)
Find windows and controls
main = app.window(title_re=".*Notepad$") # top-level window of the Application
main.wait("ready", timeout=10) # also: "exists", "visible", "enabled", "active"; combine with spaces
save = main.child_window(title="Save", control_type="Button") # uia criteria
name = main.child_window(auto_id="1001", class_name="Edit")
Useful criteria: title, title_re, class_name, class_name_re, control_type and auto_id (uia only), found_index when several match, visible_only. A lookup is lazy: it is resolved when you call a method, so a failed match raises at that moment (ElementNotFoundError, or ElementAmbiguousError for several matches).
Never guess names. Print the tree and copy the identifiers it shows:
main.print_control_identifiers() # whole subtree
main.print_control_identifiers(depth=2, filename="notepad_tree.txt")
The output lists each control with its type, title, class and the child_window call that finds it.
Act on controls
edit = main.child_window(control_type="Edit")
edit.type_keys("Q3 totals{ENTER}", with_spaces=True) # real keystrokes; {ENTER}, ^s (Ctrl+S), %{F4} (Alt+F4)
edit.set_edit_text("Replaced text") # sets the value directly, no keystrokes
print(edit.window_text()) # text of a control
main.menu_select("File->Save As...") # menu path
save.click_input() # real mouse click at the control
save.invoke() # uia: InvokePattern, no mouse needed
type_keys needs with_spaces=True, with_tabs=True, with_newlines=True to type those characters literally. Prefer invoke(), set_edit_text() and select() over click_input()/type_keys() where the control supports them: they call the control's own pattern or message instead of moving the mouse. click_input(button="right", double=True, coords=(x, y)) takes relative coordinates.
Waiting
Wait for state, not for time: win.wait("ready", timeout=20), dialog.wait_not("visible", timeout=10), win.exists(timeout=3). A pywinauto.timings.TimeoutError means the state never arrived. Global defaults live in pywinauto.timings.Timings.
Dialogs, focus and cleanup
from pywinauto import Application
app = Applicati
Установить pywinauto в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pywinauto?
Drives Windows desktop applications from Python by finding windows and controls and clicking, typing and reading them through the Win32 or UI Automation backends. Use when someone asks to "automate a Windows app that has no API", "click a button in a desktop program", "fill a legacy form from a script", "read text out of a dialog", "script Notepad or an old ERP client", or "use pywinauto". Covers Application start and connect, window and child_window lookup, print_control_identifiers, type_keys, click_input, waits and Desktop.
Как установить скилл pywinauto?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pywinauto запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic