Pascal Scripting: GetOpenFileName

Prototype:

function GetOpenFileName(const Prompt: String; var FileName: String; const InitialDirectory, Filter, DefaultExtension: String): Boolean;

Description:

Displays a dialog box that enables the user to select an existing file. Returns True if the user selected a file, False otherwise. The name of the selected file is returned in the FileName string.

Remarks:

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

Example:
var
  FileName: String;
begin
  // Set the initial filename
  FileName := '';
  if GetOpenFileName('', FileName, '',
     'Text Documents (*.txt)|*.txt|All Files|*.*', 'txt') then
  begin
    // Successful; user clicked OK
    // FileName contains the selected filename
  end;
end;