File and folder pickers
Available from PDMShell 4.1.16. Use browsefolder or browsefile to ask the user for one existing path. Selecting a path does not move, open, download, or check out the item. Unlike browse, these commands show a selection dialog rather than reveal a vault file in Explorer. A vault login is not required for the picker itself.
Use a selection in a script
browsefolder -variable Destination -title "Choose a destination folder"
msgbox -value "Selected folder: ${local.Destination}"
browsefile -variable SelectedFile -title "Choose a SOLIDWORKS file" -filter "SOLIDWORKS files|*.sldprt;*.sldasm;*.slddrw|All files|*.*"
msgbox -value "Selected file: ${local.SelectedFile}"
The default result is ${local.Name}. It lasts for the current script invocation, across its commands and selected items. Nested scripts receive independent local variables; the caller's locals are restored afterwards. Missing or expired local variables cause an error.
Names are case-insensitive, start with a letter or underscore, and contain only letters, digits, or underscores. Pass just the name to -variable, not the placeholder syntax.
Reuse a selection in the session
Use -global when entering a picker in the command box, or when several scripts need the same selection. Read the result as ${global.Name}:
browsefolder -variable Destination -global -title "Choose a destination folder"
msgbox -value "Selected folder: ${global.Destination}"
getglobal -name Destination
clearglobal -name Destination
Session globals are temporary: they are not saved to disk or shared with other users, sessions, or task runs. See Global variables. Always quote a path placeholder when passing it to a command. Selected names containing $ or expression-like text remain literal.
Starting folder and file types
Both commands accept -directory (-d) for an existing starting folder and -title for the dialog title. Both support placeholders. Relative starting folders resolve against the current vault folder when connected, otherwise the process working directory.
browsefile -filter accepts description|pattern pairs; separate multiple patterns in one pair with ;. The default is All files|*.*. The picker selects one existing file, not multiple files or a new Save As destination. The folder picker selects an existing folder and does not offer folder creation.
Cancel and errors
Cancel clears the destination variable and stops the script as cancelled, without a command error. A failed picker also clears its destination so an older selection cannot accidentally be reused. Invalid inputs and dialog failures remain command errors and follow normal script error-handling settings.
Where dialogs are supported
| Host | Supported? |
|---|---|
| Interactive PDMShell desktop script | Yes; local or global results. |
| Interactive command box | Yes; use -global. |
| Interactive PDM menu/event script with an owner window | Yes. |
| Task editor's interactive Test buttons | Yes. |
| Unattended PDM task run | No; supply explicit paths. |
| MCP command execution | No; supply explicit paths. |
MCP exposes the command descriptions and variable guidance for script authoring, but does not open these dialogs. A logged-in Windows user does not make an unattended task interactive. Testing a task interactively with a picker does not make that picker supported during scheduled execution.