Browse the docs

Choose a file or folder

Shows the macOS open or save panel and stores the path you pick.

Choose a file or folder into into

Keyboard Maestro: Prompt for File, Prompt for Files, Prompt for Folder, Prompt for Folders

Details #

Asks you for a file or folder with a standard macOS panel, and puts the chosen path in the variable named by into. The step waits for you, however long that takes (up to an hour at least). The output is the path text too.

What kind asks for:

  • file: one existing file.

  • files: several existing files. The paths are stored one per line.

  • folder: one existing folder.

  • folders: several folders, one per line.

  • newFile: a place and name to save a new file. The file is not created.

  • newFolder: a place and name for a folder. The folder is not created.

  • newFolderCreate: as newFolder, and the folder is created, including parents.

Paths come back without a trailing slash. The default kind is file.

Parameters #

ParameterTypeRequiredValuesWhat it does
defaultPathtextWhere the panel opens. ~ works. If it is a file, the panel opens in its folder.
intotextThe variable that receives the path.
kindone offile files folder folders newFile newFolder newFolderCreatefile, files, folder, folders, newFile, newFolder or newFolderCreate. Default file.
messagetextThe prompt text shown in the panel.
nametextThe suggested file or folder name, for the three new kinds.
prompttextAnother spelling of message.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Pick a file and show its name (opens a real panel)
Do
  1. Choose a file
  2. Show “You chose {{ picked }}” for 2 s
Open in Switchboard to try it

Gotchas #

  • If you press Cancel, the step fails with the system's message. Set the step's onFailure to continue if cancelling is fine.

  • The panel is a dialog from Switchboard's engine. It comes to the front when the step runs.

  • newFolderCreate fails with "couldn't create the folder" if it cannot make the folder.

  • In a dry run the step is simulated and no panel appears.

See also #

Ask for input, Open file or folder, Collect a list