jpskill.com
📦 その他 コミュニティ

macpilot-dialog-handler

MacPilotを使って、macOSのファイルを開く、保存する、印刷するなどの操作を、プログラムから自動で行えるようにし、フォルダ移動やファイル選択、ファイル名設定などをスムーズに行うSkill。

📜 元の英語説明(参考)

Handle macOS file dialogs (Open, Save, Print) with MacPilot. Navigate folders, select files, set filenames, and dismiss dialogs programmatically in any application.

🇯🇵 日本人クリエイター向け解説

一言でいうと

MacPilotを使って、macOSのファイルを開く、保存する、印刷するなどの操作を、プログラムから自動で行えるようにし、フォルダ移動やファイル選択、ファイル名設定などをスムーズに行うSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o macpilot-dialog-handler.zip https://jpskill.com/download/9638.zip && unzip -o macpilot-dialog-handler.zip && rm macpilot-dialog-handler.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9638.zip -OutFile "$d\macpilot-dialog-handler.zip"; Expand-Archive "$d\macpilot-dialog-handler.zip" -DestinationPath $d -Force; ri "$d\macpilot-dialog-handler.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して macpilot-dialog-handler.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → macpilot-dialog-handler フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

MacPilot Dialog Handler

MacPilot のダイアログコマンドを使用して、あらゆるアプリケーションに表示されるネイティブ macOS ファイルダイアログ(開く、名前を付けて保存、プリントなど)を操作します。フォルダに移動し、ファイルを選択し、ファイル名を設定し、ダイアログを確定またはキャンセルします。

使用する場面

このスキルは、以下の場合に使用します。

  • ファイルの「開く」または「保存」ダイアログが表示されており、それを操作する必要がある場合
  • ネイティブダイアログを通じてプログラムでファイルを開いたり保存したりする必要がある場合
  • モーダルダイアログ(アラート、確認)を閉じる必要がある場合
  • ダイアログに含まれる要素を検査する必要がある場合
  • ファイル選択ワークフローを自動化する必要がある場合

コマンド

ダイアログの検出

macpilot dialog detect --json
# 戻り値: モーダルダイアログ/シートが存在するかどうか、その種類、および所有アプリ

ダイアログ要素の検査

macpilot dialog inspect --json
# 戻り値: ダイアログ内のすべてのインタラクティブな要素(ボタン、テキストフィールド、リスト)
macpilot dialog inspect --depth 20 --json   # より詳細な検査

フォルダへの移動

macpilot dialog navigate "/Users/me/Documents" --json
# 「フォルダへ移動」シート(Cmd+Shift+G)を開き、パスを設定し、Returnキーを押します
# 移動が完了するまで待ちます

ダイアログ内のファイル一覧表示

macpilot dialog list-files --json
# 戻り値: 現在のダイアログの場所に表示されているファイル/フォルダのリスト

ファイルの選択

macpilot dialog select "myfile.txt" --json            # ファイルを選択(ハイライトのみ)
macpilot dialog select "myfile.txt" --confirm --json   # 選択して確定(開く/保存)

テキストフィールドの設定(ファイル名)

macpilot dialog set-field "output.pdf" --json              # 「名前を付けて保存」ダイアログでファイル名を設定
macpilot dialog set-field "query" --label "Search" --json  # 特定のラベル付きフィールドを設定
macpilot dialog set-field "text" --focused --json          # 現在フォーカスされているフィールドを設定

ダイアログボタンのクリック

macpilot dialog click-button "Save" --json
macpilot dialog click-button "Cancel" --json
macpilot dialog click-button "Open" --json
macpilot dialog click-button "Replace" --json

ダイアログの待機

macpilot dialog wait-for --timeout 30 --json         # いずれかのダイアログが表示されるまで待機
macpilot dialog wait-for --app "Safari" --json        # 特定のアプリのダイアログを待機

プライマリボタンのクリック

macpilot dialog click-primary --json                 # デフォルト/プライマリボタン(OK、許可、開くなど)をクリック
macpilot dialog click-primary --app "Finder" --json  # 特定のアプリで

ダイアログの閉じる

macpilot dialog dismiss "OK" --json           # 指定された名前のボタンをクリックして閉じる
macpilot dialog auto-dismiss --json           # 安全なデフォルト(キャンセル/OK)で自動的に閉じる

ファイルの「開く/保存」のトリガー

macpilot dialog file-open "/path/to/file.txt" --json   # 「開く」をトリガーして移動
macpilot dialog file-save "/path/to/output.pdf" --json  # 「名前を付けて保存」をトリガーして移動

完全なワークフロー

特定の場所にファイルを保存する

# 1. 「保存」ダイアログをトリガー(Cmd+S または Cmd+Shift+S)
macpilot app focus "TextEdit"
macpilot keyboard key cmd+shift+s

# 2. ダイアログが表示されるまで待機
macpilot wait seconds 1

# 3. ターゲットフォルダに移動
macpilot dialog navigate "/Users/me/Desktop"

# 4. ファイル名を設定
macpilot dialog set-field "report.txt"

# 5. 「保存」をクリック
macpilot dialog click-button "Save"

特定のファイルを開く

# 1. 「開く」ダイアログをトリガー
macpilot app focus "TextEdit"
macpilot keyboard key cmd+o

# 2. ダイアログを待機
macpilot wait seconds 1

# 3. 移動して選択
macpilot dialog navigate "/Users/me/Documents"
macpilot wait seconds 1
macpilot dialog select "readme.md" --confirm

「既存のファイルを置き換える」確認を処理する

macpilot dialog click-button "Save"
macpilot wait seconds 0.5
# 確認ダイアログが表示されたかどうかを確認
macpilot dialog detect --json
# はいの場合、「置き換える」をクリック
macpilot dialog click-button "Replace"

不明なダイアログを検査する

# まず、どのようなダイアログが表示されているかを確認
macpilot dialog detect --json

# 次に、すべてのインタラクティブな要素を検査
macpilot dialog inspect --json

# これで、利用可能なボタンとフィールドがわかります

ワンショットファイルオープン

# 「開く」ダイアログのトリガー、移動、選択を組み合わせます
macpilot dialog file-open "/Users/me/Documents/report.pdf"

重要なパターン

  1. ダイアログをトリガーした後に待機する: cmd+o または cmd+s の後には、必ず macpilot wait seconds 1 を実行して、操作する前にダイアログが完全に表示されるようにします。

  2. 選択する前に移動する: ファイルダイアログは、最後に使用したディレクトリで開きます。常に最初に正しいフォルダに dialog navigate してください。

  3. ダイアログがフォーカスを所有する: ダイアログが開いている場合、ダイアログを所有するアプリがアクティブである必要があります。MacPilot のダイアログコマンドは、すべてのアプリをスキャンしてダイアログを探すことで、これを自動的に処理します。

  4. 不明なダイアログには inspect を使用する: ダイアログにどのような要素があるかわからない場合は、最初に dialog inspect --json を実行して、利用可能なすべてのボタン、フィールド、コントロールを確認してください。

  5. カスケードダイアログを処理する: 保存操作により、「置き換えますか?」または「フォーマットしますか?」の確認ダイアログがトリガーされる場合があります。保存をクリックした後、必ず dialog detect で確認してください。

  6. set-field vs keyboard type: ファイル名を入力する場合は、keyboard type の代わりに dialog set-field を使用してください。これは、キーストロークをシミュレートするよりも信頼性の高い、AX 値を直接設定します。

  7. wait-for + click-primary: 自動化されたワークフローでは、dialog wait-for を使用してダイアログが表示されたことを検出し、次に dialog click-primary を使用してデフォルトのアクションを受け入れます。プライマリボタンのチェックでは、最初に AXDefaultButton を探し、次に一般的なラベル(OK、許可、開く、保存、続行、はい、完了、確認)にフォールバックします。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

MacPilot Dialog Handler

Use MacPilot's dialog commands to interact with native macOS file dialogs (Open, Save As, Print, etc.) that appear in any application. Navigate to folders, select files, set filenames, and confirm or cancel dialogs.

When to Use

Use this skill when:

  • A file Open or Save dialog is showing and you need to navigate it
  • You need to programmatically open or save files through native dialogs
  • A modal dialog (alert, confirmation) needs to be dismissed
  • You need to inspect what elements a dialog contains
  • You need to automate file selection workflows

Commands

Detect Dialogs

macpilot dialog detect --json
# Returns: whether a modal dialog/sheet is present, its type, and owning app

Inspect Dialog Elements

macpilot dialog inspect --json
# Returns: all interactive elements (buttons, text fields, lists) in the dialog
macpilot dialog inspect --depth 20 --json   # Deeper inspection

Navigate to Folder

macpilot dialog navigate "/Users/me/Documents" --json
# Opens the Go To Folder sheet (Cmd+Shift+G), sets the path, presses Return
# Waits for navigation to complete

List Files in Dialog

macpilot dialog list-files --json
# Returns: list of files/folders visible in the current dialog location

Select a File

macpilot dialog select "myfile.txt" --json            # Select file (highlight only)
macpilot dialog select "myfile.txt" --confirm --json   # Select and confirm (Open/Save)

Set Text Field (Filename)

macpilot dialog set-field "output.pdf" --json              # Set filename in Save dialog
macpilot dialog set-field "query" --label "Search" --json  # Set specific labeled field
macpilot dialog set-field "text" --focused --json          # Set currently focused field

Click Dialog Button

macpilot dialog click-button "Save" --json
macpilot dialog click-button "Cancel" --json
macpilot dialog click-button "Open" --json
macpilot dialog click-button "Replace" --json

Wait for Dialog

macpilot dialog wait-for --timeout 30 --json         # Wait for any dialog to appear
macpilot dialog wait-for --app "Safari" --json        # Wait for dialog in specific app

Click Primary Button

macpilot dialog click-primary --json                 # Click default/primary button (OK, Allow, Open, etc.)
macpilot dialog click-primary --app "Finder" --json  # In specific app

Dismiss Dialogs

macpilot dialog dismiss "OK" --json           # Dismiss by clicking named button
macpilot dialog auto-dismiss --json           # Auto-dismiss with safe defaults (Cancel/OK)

Trigger File Open/Save

macpilot dialog file-open "/path/to/file.txt" --json   # Trigger Open and navigate
macpilot dialog file-save "/path/to/output.pdf" --json  # Trigger Save As and navigate

Complete Workflows

Save a File to Specific Location

# 1. Trigger Save dialog (Cmd+S or Cmd+Shift+S)
macpilot app focus "TextEdit"
macpilot keyboard key cmd+shift+s

# 2. Wait for dialog to appear
macpilot wait seconds 1

# 3. Navigate to target folder
macpilot dialog navigate "/Users/me/Desktop"

# 4. Set the filename
macpilot dialog set-field "report.txt"

# 5. Click Save
macpilot dialog click-button "Save"

Open a Specific File

# 1. Trigger Open dialog
macpilot app focus "TextEdit"
macpilot keyboard key cmd+o

# 2. Wait for dialog
macpilot wait seconds 1

# 3. Navigate and select
macpilot dialog navigate "/Users/me/Documents"
macpilot wait seconds 1
macpilot dialog select "readme.md" --confirm

Handle "Replace Existing File" Confirmation

macpilot dialog click-button "Save"
macpilot wait seconds 0.5
# Check if a confirmation dialog appeared
macpilot dialog detect --json
# If yes, click Replace
macpilot dialog click-button "Replace"

Inspect an Unknown Dialog

# First, see what dialog is present
macpilot dialog detect --json

# Then inspect all its interactive elements
macpilot dialog inspect --json

# Now you know what buttons and fields are available

One-Shot File Open

# Combines triggering the open dialog, navigating, and selecting
macpilot dialog file-open "/Users/me/Documents/report.pdf"

Critical Patterns

  1. Wait after triggering dialogs: Always macpilot wait seconds 1 after cmd+o or cmd+s to let the dialog fully appear before interacting.

  2. Navigate before selecting: File dialogs open in the last-used directory. Always dialog navigate to the correct folder first.

  3. Dialog owns focus: When a dialog is open, the dialog's owning app must be active. MacPilot's dialog commands handle this automatically by scanning all apps for dialogs.

  4. Use inspect for unknown dialogs: If you're unsure what elements a dialog has, run dialog inspect --json first to see all available buttons, fields, and controls.

  5. Handle cascading dialogs: Save operations may trigger "Replace?" or "Format?" confirmation dialogs. Always check with dialog detect after clicking Save.

  6. set-field vs keyboard type: Use dialog set-field instead of keyboard type for entering filenames - it directly sets the AX value, which is more reliable than simulating keystrokes.

  7. wait-for + click-primary: For automated workflows, use dialog wait-for to detect when a dialog appears, then dialog click-primary to accept the default action. The primary button check looks for AXDefaultButton first, then falls back to common labels (OK, Allow, Open, Save, Continue, Yes, Done, Confirm).