- Procedure FileSelectNew(filename[, directory][, extension][, title])
FileSelectNew
With the procedure FileSelectNew
the user can select a new (or
existing) file using Windows’ file selection dialog box. Usually it is
used to select an output file (i.e. for writing), because other than
FileSelect
, this procedure allows you to specify new file names. If
an existing file name is selected, a warning will be displayed. The
procedure does not create any files on disk or make any changes to
existing files. It only returns the file name selected by the user.
FileSelectNew(
filename, ! (input/output) scalar string identifier
[directory,] ! (optional) scalar string expression
[extension,] ! (optional) scalar string expression
[title] ! (optional) scalar string expression
)
Arguments
- filename
A scalar string identifier holding the file name that the user specified. If on entry this strings represents a valid file name, then this file name is used to initialize the dialog box.
- directory (optional)
A scalar string representing an existing directory. The dialog box will initially only show the files that are located in this directory. If this argument is omitted, then the current project directory will be used.
- extension (optional)
A scalar string representing a file extension. The dialog box will initially only show those files that match this extension. If this argument is omitted, then all files are shown.
- title (optional)
A scalar string that is used as the title of the selection dialog box. If this argument is omitted, then a default title is used.
Return Value
The procedure returns 1 if the user actually has selected a file. If some error occurs or if the user presses the Cancel button, the procedure returns 0.
Note
If FileSelectNew
returns 0, then the first argument may not contain
a valid file name. So you must always check the return value, and, if it
is 0, either abort the current procedure or continue with some default
file name.
See also
The procedure FileSelect
.