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: asnewFolder, and the folder is created, including parents.
Paths come back without a trailing slash. The default kind is file.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
defaultPath | text | Where the panel opens. ~ works. If it is a file, the panel opens in its folder. | ||
into | text | The variable that receives the path. | ||
kind | one of | file files folder folders newFile newFolder newFolderCreate | file, files, folder, folders, newFile, newFolder or newFolderCreate. Default file. | |
message | text | The prompt text shown in the panel. | ||
name | text | The suggested file or folder name, for the three new kinds. | ||
prompt | text | Another spelling of message. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Choose a file
- Show “You chose {{ picked }}” for 2 s
Gotchas #
If you press Cancel, the step fails with the system's message. Set the step's
onFailuretocontinueif cancelling is fine.The panel is a dialog from Switchboard's engine. It comes to the front when the step runs.
newFolderCreatefails with "couldn't create the folder" if it cannot make the folder.In a dry run the step is simulated and no panel appears.