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.
-- 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 ~= "CANCEL") then
Dialog.Message("You chose the following file", result);
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.
-- 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 ~= "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.
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