window-capture
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "window-capture" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-76f862576884ef617344c73453c807ee5c8460d59fe75627df7830c0c89ed5b7. Verify the upstream source and version against https://skillhub.cn/skills/user_b22a52ba/window-capture before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A tool for silently capturing screenshots of a specified window. Used to automatically obtain screen images of a given application window without interrupting the user.
Introduction source: third_party · user_b22a52ba · 2.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: window-capture
description: 静默截取指定窗口截图技能。采用"隐藏遮挡窗口 -> 截取 -> 恢复"策略,确保只获取目标窗口自身内容,不受其他窗口遮挡。全程不激活目标窗口、不改变焦点。支持按关键词匹配窗口标题、精确匹配、列出所有可见窗口。当用户要求"截取窗口"、"截图某个窗口"、"截取微信"、"截取浏览器"、"窗口截图"、"应用截图"、"后台截图"、"静默截图"等意图时触发。触发关键词:截取窗口、窗口截图、截图窗口、window
capture、截取应用、截取微信、截取浏览器、截取WPS、截取软件、截取桌面程序、后台截图、静默截图、不激活截图。
version: 2.0.0
tags:
- wechat
slug: window-capture
displayName: Window Capture
summary: 静默截取指定窗口截图技能窗口截图
静默截取指定窗口,确保只获取目标窗口自身内容,不受遮挡。
核心脚本
scripts/stealth_capture.py
使用 python_cell_exec 直接调用函数,无需读取脚本内容:
from stealth_capture import find_window, capture_window_stealth, list_windows
# 列出所有可见窗口
windows = list_windows()
for hwnd, title, left, top, right, bottom in windows:
print(f" - {title}")
# 按关键词模糊匹配并静默截图
info = find_window("微信")
capture_window_stealth(info, "/path/to/output.png")
# 精确匹配
info = find_window("微信", exact=True)
capture_window_stealth(info)
# 截取当前活动窗口
from stealth_capture import find_active_window
info = find_active_window()
capture_window_stealth(info)
核心函数
| 函数 | 说明 | 返回值 |
|---|---|---|
list_windows() |
列出所有可见窗口 | [(hwnd, title, l, t, r, b), ...] |
find_window(keyword, exact=False) |
静默查找窗口 | 元组 or None |
find_active_window() |
获取前台窗口 | 元组 or None |
capture_window_stealth(window_info, path) |
静默截图并保存 | 文件绝对路径 |
参数说明
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
keyword |
str | - | 窗口标题关键词 |
exact |
bool | False | True 精确匹配,False 模糊匹配 |
output_path |
str | 自动生成 | 保存路径,支持 .png/.jpg/.bmp |
原理
- 用
EnumWindows获取所有可见窗口及其坐标 - 检测与目标窗口区域重叠的其他窗口
- 用
ShowWindow(hwnd, SW_HIDE)临时隐藏遮挡窗口 - 等待 100ms 让 DWM 桌面合成器刷新
ImageGrab.grab(bbox)截取屏幕区域- 立即
ShowWindow(hwnd, SW_SHOW)恢复所有隐藏窗口
整个过程约 150ms,遮挡窗口会短暂消失后立即恢复。
scripts/capture_window.py 为旧版回退方案(基于 pygetwindow),一般不需要使用。
注意事项
- 仅限 Windows 平台
- 遮挡窗口会短暂闪烁约 150ms(隐藏后立即恢复)
- 不激活目标窗口,不改变前台焦点
- 最小化窗口无法截取,会报错提示
Current listing version
2.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决多窗口遮挡下精准截图的核心痛点,具备明确实用价值
- 支持模糊/精确匹配、列出窗口等灵活用法,覆盖常见场景
Highlights
- 触发词覆盖全面,包含中英文及多种表达变体,边界清晰
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档未显式划分 When to Use 使用场景说明
Recommendation: 建议在原理前增加 When to Use 章节,明确适用场景与限制
-
缺少端到端完整示例 Reported severity: Minor
仅有代码片段,缺乏从触发到保存的完整流程示例
Recommendation: 补充一个完整示例,展示从查找窗口到保存截图的全流程
Highlights
- 结构清晰,函数与参数说明完整,原理阐述到位
Areas to improve
-
异常处理覆盖不全 Reported severity: Minor
未显式处理文件写入权限、路径不存在等常见异常
Recommendation: 建议在 capture_window_stealth 函数中增加路径校验与异常捕获,并给出友好提示
Highlights
- 工具来源明确,核心流程有隐藏遮挡窗口的恢复机制,可靠性基础良好
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Screenshots or screen capture
Capture only a selected window or region. Avoid secrets and private records and review captures before sharing.
Mentioned in main document · lines 68
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.