Initiates a Open File Dialog.
FileOpenDialog ( "title", "init dir", "filter" [, options [, "default name" [, hwnd]]] )
| title | Title text of the Dialog GUI. |
| init dir | Initial directory selected in the GUI file tree. |
| filter | File type single filter such as "All (*.*)" or "Text files (*.txt)" or multiple filter groups such as "All (*.*)|Text files (*.txt)" (See Remarks). |
| 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, ending with a backslash) 4 = Allow MultiSelect 8 = Prompt to Create New File (if does not exist) |
| default name | [optional] Suggested file name for the user to open. Default is blank (""). |
| hwnd | [optional] The window handle to use as the parent for this dialog. |
| Success: | Returns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..." |
| Failure: | Sets @error |
| @error: | 1 - File selection failed. |
| 2 - Bad file filter |
Local $message = "Hold down Ctrl or Shift to choose multiple files."
Local $var = FileOpenDialog($message, @WindowsDir & "\", "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
; Multiple filter group
$message = "Hold down Ctrl or Shift to choose multiple files."
$var = FileOpenDialog($message, @WindowsDir & "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", 1 + 4)
If @error Then
MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringReplace($var, "|", @CRLF)
MsgBox(4096, "", "You chose " & $var)
EndIf