ChooseFile (FPScript)
Opens a dialog box for choosing a file.
Syntax
ChooseFile(Title, FilePath, Folder, Filter)
The syntax of the ChooseFile function consists of the following parts:
Part |
Description |
---|---|
Title |
String with a title for the dialog box. Permitted data structures are scalar value. Supported data types are string. |
FilePath |
A default for the file name. Specify an empty string if you do not want to preset a file name. Permitted data structures are scalar value. Supported data types are string (file name). |
Folder |
A default for the path of the folder from which the file is to be chosen. Permitted data structures are scalar value. Supported data types are string (folder name). |
Filter |
A series of string pairs representing file filters for displaying the files. The filter specifies the file type required for a file in order to be displayed in the file list. The first string of a pair describes the filter, and the second string specifies the name of the file extension to be used. You can specify several extensions by separating them with ';'. The individual filters are separated from each other using a '|' character. Two '|' characters are placed after the last filter. If you specify a file filter, only the files passing the filter appear in the list box. Specify an empty string if you do not want to use a filter. Permitted data structures are scalar value. Supported data types are string. |
Remarks
The result is a string with the full path name of the chosen file.
If an argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
ChooseFile("Select File", "", "C:\\Data", "Text Files (*.txt; *.asc)|*.txt; *.asc|Data Files (*.dat)|*.dat|All Files (*.*)|*.*||")
Opens a dialog box with the title "Select File" and shows all files with the extension ".txt" or ".asc" in the folder "C:\Data". The selected file name is returned with the path.