selectFolder([settings])
Opens a selection dialog that allows to select a folder. The settings object can be used to add a prompt text at the top of the dialog and to set the dialog’s starting folder.
Type: function
Parameter(s):
- settings {Object} Optional:
A settings object to control the function’s behavior.
- settings.prompt {String} Optional:
The prompt text at the top of the folder selection dialog. Default:
""
(no prompt) - settings.folder {} Optional:
Folder or a folder path string defining the start location of the dialog. Default: most recent dialog folder or main user folder.
Returns:
-
{Folder | Null}:
The selected folder. If the user cancels,
null
will be returned.
Example(s):
Open folder selection dialog with a prompt text
selectFolder({prompt: "Please select a folder."});
Open folder selection dialog starting at the user's desktop
selectFolder({folder: "~/Desktop/"});