Core Function FileOpenDialog
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> FileOpenDialog ( <title>, <dir>, <filter>, <options>, <default name> ) </pre> === Description === Initiates a Load File Dialog. === Parameters === ==== title ==== Titl...") |
(→options) |
||
Line 25: | Line 25: | ||
Optional; | Optional; | ||
<pre> | <pre> | ||
− | [optional] Dialog Options: To use more than one option, | + | [optional] Dialog Options: To use more than one option, use a + sign to separate them (eg: 1 + 4). |
1 = File Must Exist (if user types a filename) | 1 = File Must Exist (if user types a filename) | ||
2 = Path Must Exist (if user types a path) | 2 = Path Must Exist (if user types a path) |
Revision as of 12:44, 28 November 2011
FileOpenDialog ( <title>, <dir>, <filter>, <options>, <default name> )
Contents |
Description
Initiates a Load File Dialog.
Parameters
title
Title text of the Dialog GUI.
dir
Initial directory selected in the GUI file tree.
filter
File type filter such as "All (*.*)" or "Text files (*.txt)"
options
Optional;
[optional] Dialog Options: To use more than one option, use a + sign to separate them (eg: 1 + 4). 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; File name to suggest to the user to save the file with.
Return Value
Success: Returns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..."
Failure: Returns empty string.
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.
Example
$message = "Hold down Ctrl or Shift to choose multiple files."; $var = FileOpenDialog($message, @WinDir, "Images (*.jpg;*.bmp)", 1 + 4 ); If (!$var) { MsgBox("No File(s) chosen"); } Else { $var = Replace($var, "|", @CRLF); MsgBox("You chose $var"); }