Use the built-in screencapture command on macOS to capture the screen.
Use Cases
- The user says "take a screenshot for me" or "capture the current screen"
- The user needs to save the content of the current page
- The task requires viewing information on the screen
Command Reference
Full-Screen Screenshot
screencapture -x "/tmp/screenshot_$(date +%Y%m%d_%H%M%S).png"
Parameter Description:
-xSilent mode (does not play the shutter sound)
Window Screenshot
# 交互式选择窗口
screencapture -x -w "/tmp/window_$(date +%Y%m%d_%H%M%S).png"
Region Screenshot
# 交互式选择区域
screencapture -x -s "/tmp/region_$(date +%Y%m%d_%H%M%S).png"
Delayed Screenshot
# 延迟 3 秒后截图
screencapture -x -T 3 "/tmp/delayed_$(date +%Y%m%d_%H%M%S).png"
Screenshot to Clipboard
# 截图直接复制到剪贴板
screencapture -x -c
Common Parameters
| Parameter | Description |
|---|---|
-x |
Silent, does not play sound |
-w |
Window mode |
-s |
Region selection mode |
-c |
Output to clipboard |
-T <秒> |
Delayed screenshot |
-t <格式> |
Output format (png/jpg/pdf) |
Output Specifications
- By default, save to the
/tmp/directory, with the filename containing a timestamp - After the screenshot is complete, inform the user of the save path
- If the user specifies a save location, use the path specified by the user