Pascal Scripting: GetOpenFileNameMulti

Prototype

function GetOpenFileNameMulti(const Prompt: String; const FileNameList: TStrings; const InitialDirectory, Filter, DefaultExtension: String): Boolean;

Description

Displays a dialog box that enables the user to select one or more existing file(s). Returns True if the user selected a file, False if the user cancelled the dialog box. The name of the selected file(s) is returned in the FileNameList list.

An exception will be raised if an error occurs.

Remarks

An example Filter: 'Text files (*.txt)|*.txt|All files (*.*)|*.*'

Example:
var
  FileNameList: TStrings;
begin
  // Create the list
  FileNameList := TStringList.Create;
  try
    if GetOpenFileNameMulti('', FileNameList, '',
       'Text Documents (*.txt)|*.txt|All Files|*.*', 'txt') then
    begin
      // Successful; user clicked OK
      // FileNameList contains the selected filename(s)
    end;
  finally
    FileNameList.Free;
  end;
end;