macOS Screen Capture Automation
Teaches Claude to find macOS window IDs with Swift, adjust the view via AppleScript, and capture exact app windows with screencapture.
AutomationIntermediate★ 1,323⑂ 212AI score 8/10Last updated: Aug 8, 2026
What it does
Gives Claude a proven three-step workflow for programmatically capturing a specific application window on macOS:
- Find the window — Swift +
CGWindowListCopyWindowInfoenumerates on-screen windows and returns the numeric Window ID (the only reliable route on macOS). - Control the view — AppleScript (
osascript) activates the app and, for Microsoft Excel, sets zoom, scrolls to a row/column, selects sheets and cell ranges. - Capture —
screencapture -x -l <WID>writes silent PNG/JPEG output, withsipsfor downscaling Retina 2x images.
It also documents timeout guards so osascript never hangs, a step-by-step Screen Recording permission triage flow, and a table of approaches that are confirmed to fail (System Events window id, PyObjC Quartz, etc.) so you skip the dead ends.
Who it's for
- Technical writers producing repeatable screenshots for docs and release notes
- Analysts capturing consistent views of Excel models or dashboards for reports
- Developers automating visual QA / regression screenshots on macOS
- Anyone who wants to "show Claude the screen" for review
Examples
- Batch Excel report shots: open a workbook, set zoom to 130%, then scroll to row 1, row 45, and the "DCF" sheet to produce
section_a.png,section_b.png, anddcf_overview.png. - Clean app-window docs images: run
swift scripts/get_window_id.swift Chrome, grab the WID, and capture just the browser window without desktop clutter. - Permission debugging: when capture fails, print the
--permission-hint screenchecklist and jump straight to the Screen Recording pane in System Settings.
· · · Install guide · · ·
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the capture-screen folder from the GitHub repo daymade/claude-code-skills into my ~/.claude/skills/capture-screen/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/daymade/claude-code-skills.git /tmp/claude-code-skills && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-skills/capture-screen ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Prerequisites: macOS plus Xcode Command Line Tools. Run
swift --version; if it fails, runxcode-select --install. - Clone the repo:
git clone https://github.com/daymade/claude-code-skills.git ~/claude-code-skills - Create the skills folder:
mkdir -p ~/.claude/skills - Copy the skill:
cp -r ~/claude-code-skills/capture-screen ~/.claude/skills/ - Verify:
ls ~/.claude/skills/capture-screenshould showSKILL.mdand ascripts/directory. - Grant permission: System Settings → Privacy & Security → Screen Recording, enable your terminal (Terminal/iTerm) or the Claude Code app, then restart that app.
- Test it: restart Claude Code and ask "capture the Chrome window", or run
swift ~/.claude/skills/capture-screen/scripts/get_window_id.swift Chromedirectly to confirm a WID is printed.
View source on GitHub ↗License: MIT