getfiled

(getfiled title preset_file extension flags)

The getfiled function displays a standard dialog box to let the user specify a filename, for example to open an existing or new file.

Arguments

title specifies the caption of the dialog box.

preset_file can contain a filename recommended as the default value for the filename specification (text string).

extension can contain one or more pre-defined file extensions. To specify multiple file types, the file extensions must separate by a comma. If "" is supplied as an argument, no file type restriction ("*") is set.

flags specifies bit-coded control flags with the following meaning:

Flags Meaning
Bit 0 Set: A dialog to open a new file is displayed.
Otherwise: A dialog to open an existing file is displayed.
Bit 1 Not used.
Bit 2 Set: Allows the user to specify any file extension.
Otherwise: Allows the user to use only the file extension set as default.
Bit 3 Not used.
Return Value

If a valid filename has been specified, the function returns it; otherwise, the function returns nil.

Examples

: (getfiled "Select a file" "" "" 0)

: (getfiled "Write to file" "test.txt" "txt" 1)