Function Reference

FileOpenDialog

Initiates a Open File Dialog.

FileOpenDialog ( "title", "init dir", "filter" [, options [, "default name"]] )

 

Parameters

title Title text of the Dialog GUI.
init dir Initial directory selected in the GUI file tree.
filter File type filter such as "All (*.*)" or "Text files (*.txt)"
options [optional] Dialog Options: To use more than one option, add the required values together.
  1 = File Must Exist (if user types a filename)
  2 = Path Must Exist (if user types a path)
  4 = Allow MultiSelect
  8 = Prompt to Create New File (if does not exist)
 16 = Prompt to OverWrite File (see FileSaveDialog)
default name [optional] Suggested file name for the user to open.

 

Return Value

Success: Returns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..."
Failure: Sets @error to 1.

 

Remarks

Separate the file filters with a semicolon as shown in the example.
Note: At this time, multiple groups of filters are not supported.

If default name is given, options must also be given. If none of the options are wanted, use 0 for options.

Special Windows folders (such as "My Documents") can be sometimes be set as the init dir; see Appendix.

 

Related

FileSaveDialog, FileSelectFolder, StringSplit

 

Example


$message = "Hold down Ctrl or Shift to choose multiple files."

$var = FileOpenDialog($message, "C:\Windows\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf