# Prompt for File or Folder

This function is typically used to select either a folder or file from a standard OS X file open dialog. The selected item's path will be saved in a track variable or a named variable.

You can specify that you allow selecting a file or a folder or either.

You can allow multiple files or folders to be selected. When more than one item is selected, the destination variable will contain a list of items separated by the default list delimiter (\~).

When prompting for files you can optionally supply a list of filename extensions which will be accepted. The extensions are separated by spaces, commas (,), slashes (/), newline characters or the default list delimiter (\~). Note, you do not have to include a leading . on an extension. Hint: enter public.image to accept all image files.

When files and folders can be selected you may have to use a Test If File Exists statement to determine if a returned path is a file or folder.

The supplied text strings may contain any of the escape sequences described in Escape Sequences. Only the first non blank line of the prompt will be displayed.

The statement supports additional configurability which is documented in Common Prompt Statement Functionality. These settings can be configured by clicking on small button with the gear icon.

You can elect to issue a beep with the prompt.

The prompt is only issued once per set of files when run stepwise.

The function is valid while batch processing but is intended to be used within the special Batch Start and Batch End inline actions.

By default, the statement will cause action processing to be terminated if the user selects Cancel as opposed to providing a selection. If the set state option is enabled, the action test state will be set to false if the user cancelled otherwise it will be set to true.