pywinauto▌
malue-ai/dazee-small · updated Jun 1, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
通过 pywinauto 操作任意 Windows 桌面应用:发现窗口、检查控件、点击按钮、输入文字、读取内容。
- ›支持两种后端:Win32 API(传统应用)和 MS UI Automation(现代应用)。
Windows UI 自动化(pywinauto)
通过 pywinauto 操作任意 Windows 桌面应用:发现窗口、检查控件、点击按钮、输入文字、读取内容。 支持两种后端:Win32 API(传统应用)和 MS UI Automation(现代应用)。
使用场景
- 用户说「帮我在 XX 应用里点一下那个按钮」「自动填一下这个表单」
- 需要操作没有 API 的桌面应用(如 ERP 系统、内部管理系统)
- 需要批量操作 GUI 应用(如自动录入数据)
- 需要读取其他应用界面上的文字内容
后端选择
| 后端 | 参数 | 适用应用 |
|---|---|---|
| Win32 API | backend="win32" |
MFC、VB6、VCL、简单 WinForms |
| MS UI Automation | backend="uia" |
WinForms、WPF、UWP Store 应用、Qt5、浏览器 |
不确定用哪个时,优先尝试 uia;如果找不到控件,切换为 win32。
命令参考
连接到已有应用
from pywinauto import Application
# 方式 1:通过窗口标题连接
app = Application(backend="uia").connect(title="记事本", timeout=10)
# 方式 2:通过进程名连接
app = Application(backend="uia").connect(path="notepad.exe")
# 方式 3:通过进程 ID 连接
app = Application(backend="uia").connect(process=12345)
启动新应用
from pywinauto import Application
app = Application(backend="uia").start("notepad.exe")
# 等待窗口出现
app.window(title_re=".*记事本.*").wait("ready", timeout=10)
发现窗口和控件
# 列出所有顶层窗口
from pywinauto import Desktop
windows = Desktop(backend="uia").windows()
for w in windows:
print(f"{w.window_text()} — {w.class_name()}")
# 打印窗口控件树(调试用)
dlg = app.window(title_re=".*记事本.*")
dlg.print_control_identifiers()
点击按钮和菜单
dlg = app.window(title="记事本")
# 点击菜单
dlg.menu_select("文件->打开")
# 点击按钮(通过文本匹配)
dlg.child_window(title="确定", control_type="Button").click()
# 点击按钮(通过 auto_id)
dlg.child_window(auto_id="btnSubmit").click()
输入文字
dlg = app.window(title="记事本")
# 输入到编辑框
edit = dlg.child_window(control_type="Edit")
edit.set_text("要输入的内容")
# 模拟键盘输入(支持特殊键)
edit.type_keys("Hello{ENTER}World", with_spaces=True)
# 特殊键:{ENTER} {TAB} {ESC} {DELETE} {BACKSPACE}
# 修饰键:^ = Ctrl, % = Alt, + = Shift
# 例:Ctrl+A = ^a, Ctrl+Shift+S = ^+s
读取界面内容
dlg = app.window(title="记事本")
# 读取文本框内容
content = dlg.child_window(control_type="Edit").window_text()
# 读取列表项
listbox = dlg.child_window(control_type="List")
items = [item.window_text() for item in listbox.children()]
# 读取表格
table = dlg.child_window(control_type="Table")
for row in table.children():
cells = [c.window_text() for c in row.children()]
print(" | ".join(cells))
等待与同步
# 等待窗口出现
dlg = app.window(title="保存").wait("visible", timeout=10)
# 等待窗口消失
app.window(title="加载中...").wait_not("visible", timeout=30)
# 等待控件可用
dlg.child_window(title="提交").wait("enabled", timeout=5)
窗口管理
dlg = app.window(title="记事本")
# 最大化 / 最小化 / 还原
dlg.maximize()
dlg.minimize()
dlg.restore()
# 移动和调整大小
dlg.move_window(x=100, y=100, width=800, height=600)
# 置顶
dlg.set_focus()
# 关闭
dlg.close()
滚动
from pywinauto import mouse
# 向下滚动 3 格(在指定坐标位置)
mouse.scroll(coords=(500, 400), wheel_dist=-3)
# 向上滚动 5 格
mouse.scroll(coords=(500, 400), wheel_dist=5)
# 在控件内滚动(先获取控件位置)
rect = dlg.child_window(control_type="List").rectangle()
mouse.scroll(coords=(rect.mid_point()), wheel_dist=-3)
鼠标坐标操作
from pywinauto import mouse
# 移动鼠标到坐标
mouse.move(coords=(500, 300))
# 在指定坐标左键点击
mouse.click(coords=(500, 300))
# 右键点击
mouse.right_click(coords=(500, 300))
# 双击
mouse.double_click(coords=(500, 300))
拖拽
from pywinauto import mouse
# 拖拽:从 (100,200) 到 (300,400)
mouse.press(coords=(100, 200))
mouse.move(coords=(300, 400))
mouse.release(coords=(300, 400How to use pywinauto on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add pywinauto
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches pywinauto from GitHub repository malue-ai/dazee-small and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate pywinauto. Access the skill through slash commands (e.g., /pywinauto) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★48 reviews- ★★★★★Maya Farah· Dec 28, 2024
Solid pick for teams standardizing on skills: pywinauto is focused, and the summary matches what you get after install.
- ★★★★★Chaitanya Patil· Dec 12, 2024
pywinauto fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Valentina Kim· Dec 12, 2024
Registry listing for pywinauto matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Valentina Jackson· Dec 12, 2024
I recommend pywinauto for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Kwame Srinivasan· Dec 8, 2024
pywinauto has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Maya Nasser· Dec 4, 2024
Useful defaults in pywinauto — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Henry Tandon· Nov 23, 2024
Registry listing for pywinauto matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Piyush G· Nov 3, 2024
pywinauto is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Valentina White· Nov 3, 2024
Useful defaults in pywinauto — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Mia Li· Nov 3, 2024
pywinauto reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 48