macpilot-screenshot-ocr について
macpilot-screenshot-ocrは、画面をキャプチャし、Apple Vision OCRで文字を抽出するスキルです。アプリの状態確認、画面上の文字を探してクリックする操作、画面録画などに利用できます。
主な機能
- 01全画面、領域、ウィンドウをキャプチャ
- 02画像や画面領域の文字をOCR
- 03OCR言語を選択
- 04認識した文字を検索してクリック
- 05画面録画の開始、一時停止、再開
- 06ディスプレイの寸法と配置を取得
活用シーン
- 01スクリーンショットや画面領域の文字を読む
- 02アプリの表示状態を確認
- 03座標を調べずに文字付きの操作部品をクリック
- 04アプリの操作手順を録画
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ adhikjoshi/ macpilot-skills --skill macpilot-screenshot-ocrインストール後、Claude Code で/macpilot-screenshot-ocrを入力して読み込まれたか確認します。
詳細
MacPilot のスクリーンショットと OCR
MacPilot を使用して、画面全体、特定の領域、またはアプリケーションウィンドウのスクリーンショットを撮影し、Apple に組み込まれている Vision OCR を使って画像や画面領域からテキストを抽出できます。
使用する場面
次のような場合にこのスキルを使用します。
- 現在画面に表示されている内容を撮影する必要がある場合
- 画像ファイルからテキストを抽出する必要がある場合
- 画面の特定の領域からテキストを読み取る必要がある場合
- 特定のアプリウィンドウを撮影する必要がある場合
- アプリケーションの表示状態を確認する必要がある場合
- 画面録画を撮影する必要がある場合
スクリーンショットコマンド
画面全体
macpilot screenshot --json # Capture to temp file
macpilot screenshot ~/Desktop/screen.png --json # Capture to specific path
macpilot screenshot --with-permissions --json # Use CGWindowListCreateImage directly
特定の領域
macpilot screenshot --region 100,200,800,600 --json
# Region format: x,y,width,height (from top-left corner)
特定のウィンドウ
macpilot screenshot --window "Safari" --json # Capture Safari window
macpilot screenshot --window "Finder" --json # Capture Finder window
すべてのウィンドウ
macpilot screenshot --all-windows --json # Each window separately
特定のディスプレイ
macpilot screenshot --display 1 --json # Second display (0-indexed)
フォーマットのオプション
macpilot screenshot --format png ~/Desktop/shot.png # PNG (default, lossless)
macpilot screenshot --format jpg ~/Desktop/shot.jpg # JPEG (smaller files)
OCR コマンド
画像ファイルからテキストを抽出する
macpilot ocr scan /path/to/image.png --json
macpilot ocr scan ~/Desktop/screenshot.png --json
画面の領域からテキストを抽出する
macpilot ocr scan 100 200 800 600 --json
# Arguments: x y width height (captures region then OCRs it)
多言語 OCR
macpilot ocr scan image.png --language en-US --json # English
macpilot ocr scan image.png --language ja --json # Japanese
macpilot ocr scan image.png --language zh-Hans --json # Simplified Chinese
macpilot ocr scan image.png --language de --json # German
macpilot ocr scan image.png --language fr --json # French
OCR クリック(画面上のテキストを見つけてクリック)
macpilot ocr click "Submit" --json # Find text on screen and click it
macpilot ocr click "OK" --app Finder --json # Click text in specific app
macpilot ocr click "Accept" --timeout 10 --json # Retry until text appears (10s)
OCR クリックでは、スクリーンショットを撮影して OCR を実行し、一致するテキスト(大文字と小文字を区別しません)を見つけて、その中心座標をクリックします。テキストが表示されるのを待つ間にポーリングして再試行するには、--timeout を使用します。
画面録画(ScreenCaptureKit)
録画を開始する
macpilot screen record start --output ~/Desktop/recording.mov --json
macpilot screen record start --output rec.mov --region 0,0,1920,1080 --json # Region
macpilot screen record start --output rec.mov --window Safari --json # Window
macpilot screen record start --output rec.mov --display 1 --json # Display
macpilot screen record start --output rec.mov --audio --json # With audio
macpilot screen record start --output rec.mov --quality high --fps 60 --json # Quality
録画を操作する
macpilot screen record stop --json # Stop and save
macpilot screen record status --json # Check if recording
macpilot screen record pause --json # Pause recording
macpilot screen record resume --json # Resume recording
品質のオプションは、low(1 Mbps)、medium(5 Mbps、デフォルト)、high(10 Mbps)です。FPS のデフォルトは 30 です。
ディスプレイ情報
macpilot display-info --json
# Returns: all displays with resolution, position, scale factor
ワークフローのパターン
1 つのフローで撮影と OCR を行う
# Take screenshot of specific region
macpilot screenshot --region 0,0,1920,1080 ~/tmp/capture.png --json
# Extract text from it
macpilot ocr scan ~/tmp/capture.png --json
画面領域をすばやく OCR で読み取る
# Directly OCR a screen region without saving
macpilot ocr scan 200 100 600 400 --json
テキストを見つけてクリックする(座標計算不要)
# Instead of screenshot > OCR > parse > click, just:
macpilot ocr click "Submit" --json
macpilot ocr click "Next" --timeout 5 --json # Wait up to 5s for text to appear
UI の状態を確認する
# Screenshot a window to see its current state
macpilot screenshot --window "Safari" ~/tmp/safari.png --json
# Read the image to verify content
macpilot ocr scan ~/tmp/safari.png --json
自動化を録画する
macpilot screen record start --output ~/Desktop/demo.mov
macpilot app open Safari
macpilot wait seconds 2
macpilot keyboard key cmd+l
macpilot keyboard type "https://example.com"
macpilot keyboard key enter
macpilot wait seconds 3
macpilot screen record stop
ヒント
- MacPilot.app に「システム設定」で画面収録の許可を付与する必要があります
- テキストを含むスクリーンショットには PNG(可逆圧縮)、写真には JPEG が最適です
- OCR はコントラストの高いテキストで最も効果を発揮します。テキストが小さい場合は、スクリーンショットの領域を広げてください
- 特定の領域を撮影する前に
display-infoを使って画面の寸法を確認してください - 座標系は左上(0,0)から始まり、x は右方向、y は下方向に増加します
- Retina ディスプレイでは、座標は論理ポイント(物理ピクセルではありません)で表されます
コメント
Markdown 対応