Save File Dialog Box

The savefile command displays the save file dialog box and prints the selected file path. It's syntax is as follows:

savefile [<title>="Save As" [<startupdir>=<current_directory> [<filter>="*.*" [<errormsg>="" [<isforwardslash>="true"]]]]]

The "title" is the title of the save file dialog box. It's default value is "Save As".

The "startupdir" is the initial directory which will be shown in the save file dialog box. By default the current working directory is shown as the initial directory. If "startupdir" includes a file name, the file will be selected. The specified path should have forward slash '/' as the path separator and not the backward slash.

The "filter" specifies the file extensions. Only files that match the given filter are shown. If you want multiple filters, separate them with ';;', for example:
"Images (*.png *.gif *.jpg);;Text files (*.txt);;XML files (*.xml)"

The "errormsg" is the message printed when the user closes the save file dialog box without selecting any file. By default no error message is displayed.

The "isforwardslash" specifies the path separator of the file path which will be printed on screen. It can have values "true" or "false". By default forward slash is used as a path separator. If "false" is specified the backward slash '\' is used as a path separator.

Note: The parameters "title", "startupdir", "filter" and "errormsg" may be empty strings (""). In this case, the default values are used.

Example: savefile "Save Image" D:/ "Images (*.jpg *.gif)" "No file selected" false

The above command displays a save file dialog box with title "Save Image". The initial directory is set to D:\ drive. The user can select the files with extension ".gif" or ".jpg". "No file selected" is the error message shown if user does not select any file and the output i.e. the file path is printed with backward slash '\' as the path separator.

Note that the arguments which contain spaces are enclosed within a pair of double quotes.


Documentation Index Page