GetFileName

Open the "Open" dialog box for the file

Please see the dlgFile X-Function.

Syntax:

getfilename [option] argument

 

Options:

no option; Open the Open dialog box

Syntax: getfilename file

Open the Open dialog box, with file displayed in the Files of Type drop-down list.file is the default file type specification. After editing the dialog box, %A contains the file name and %B contains the full path to the file.

GetFileName *.txt; //Select the file.
%B=; //Get the full path to the file.
%A=; //Get the file name.

-g; Get the nth file name

Syntax: getfilename -g n

Get the nth file name with full path into the %A string variable from the file list created by

getfile -m *.TXT; //select multiple file.
getfile -g 2; //Get the full path of the second file.
%A=;

file is the default file specification and the default file type specification.

-m; Open the Import Multiple ASCII dialog box

Syntax: getfilename -m file

Opens the Import Multiple ASCII dialog box. The number of files selected is stored in the variable count.

Examples:

Example 1 The following script prompts for a file name and imports ASCII data into the active worksheet.

getfile *.dat;impASC fname:=%A

Example 2 The next script prompts for a file name with multiple types (Lotus and DIF files) of files to import into the worksheet.

getfile *.WKS *.DIF;open -wf %A;

Example 3 The following script (placed in a button on a worksheet) prompts the user to select multiple files and prints the file names to the Script window.

type -a; //open the Script window 
getfile -m *.*;  // prompt for multiple files 
for (ii = 1; ii <= count; ii ++)   
{
      getfile -g ii; // get the iith file into %A 
      type "%A"; // print it out in the Script window
};