table Dialog.FileBrowse ( 

boolean FileOpen,

string  Title,

string  DefaultFolder,

string  FileFilters = "All Files (*.*)|*.*|",

string  Filename = "",

string  FileExtension = "",

boolean MultipleSelect = false,

boolean FileMustExist = false )

Example 1

files = Dialog.FileBrowse(true, "Open File", _ProgramFilesFolder, "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);

Prompts the user to select a single text file in their Program Files folder, and stores the path to the file they select in a table named "files."

Note: _ProgramFilesFolder is a built-in variable that contains the path to the user's "Program Files" folder.

Example 2

-- Display a single-selection file browse dialog
result = Dialog.FileBrowse(true, "Load File", _DesktopFolder, "Microsoft Word Document (*.doc)|*.doc|All Files (*.*)|*.*|", "", "", false, true);

-- If CANCEL was not chosen, then let's get the file path
if (result[1] ~= "CANCEL") then
    Dialog.Message("You chose the following file", result[1]);

Prompts the user to select a single Word document file (.doc) browsing from their Desktop folder, and stores the path to the file they select in a table named "result." If the cancel button was not chosen, a dialog message is displayed showing the file path that is stored in the table.

Example 3

-- Prompt the user to select files to add to the zip archive.
archive_files = Dialog.FileBrowse(true, "Files to Add", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", true, false);

-- Check to see if an error occurred, or the user cancelled.
if (archive_files[1] ~= "CANCEL") and (archive_files ~= nil) then

    -- Show the status dialog.

    -- Add the chosen files to the zip archive.
    Zip.Add(_DesktopFolder.."\\NewArchive.zip", archive_files, true, "", 5, nil, false);

    -- Get the error code of the zip.add action.
    error = Application.GetLastError();

    -- Hide the status dialog.

    -- If it succeeded, display a success message and open the folder. Otherwise display the error message.
    if (error == 0) then
        Dialog.Message("Success", "The files were successfully archived.", MB_OK, MB_ICONINFORMATION);

        -- Open the folder where the zip file was created.
        File.ExploreFolder(_DesktopFolder, SW_SHOWNORMAL);
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);

 A file browse dialog is displayed allowing the user to select files they would like added to a Zip archive. The selected files are then added to a Zip archive created on their desktop. If the process is successful, a success message is displayed. If there was an error, the error code message is shown.

See also:  Related Actions