Handle macOS file dialogs (Open, Save, Print) with MacPilot. Navigate folders, select files, set filenames, and dismiss dialogs programmatically in any application.
Install
npx skillscat add adhikjoshi/macpilot-skills/macpilot-dialog-handler Install via the SkillsCat registry.
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 appInspect Dialog Elements
macpilot dialog inspect --json
# Returns: all interactive elements (buttons, text fields, lists) in the dialog
macpilot dialog inspect --depth 20 --json # Deeper inspectionNavigate 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 completeList Files in Dialog
macpilot dialog list-files --json
# Returns: list of files/folders visible in the current dialog locationSelect 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 fieldClick 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" --jsonDismiss 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 navigateComplete 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" --confirmHandle "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 availableOne-Shot File Open
# Combines triggering the open dialog, navigating, and selecting
macpilot dialog file-open "/Users/me/Documents/report.pdf"Critical Patterns
Wait after triggering dialogs: Always
macpilot wait seconds 1aftercmd+oorcmd+sto let the dialog fully appear before interacting.Navigate before selecting: File dialogs open in the last-used directory. Always
dialog navigateto the correct folder first.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.
Use inspect for unknown dialogs: If you're unsure what elements a dialog has, run
dialog inspect --jsonfirst to see all available buttons, fields, and controls.Handle cascading dialogs: Save operations may trigger "Replace?" or "Format?" confirmation dialogs. Always check with
dialog detectafter clicking Save.set-field vs keyboard type: Use
dialog set-fieldinstead ofkeyboard typefor entering filenames - it directly sets the AX value, which is more reliable than simulating keystrokes.