Contents - Index


GetFirstFile$ and GetNextFile$ (Macro Commands)

 

GetFirstFile$(*.XXX,RECURSE)

GetFirstFile$ will return the complete file name (including the path) of the first file found in the current directory having a file name extension of *.XXX.  The file name is assigned to a string variable, as shown in the example.  The directory can be selected with the SetDirectory macro command.  The GetFirstFile$ command is normally used with the GetNextFile$ command to obtain a complete list of all files in a directory with the specified file name extension.  If a file having the specified file name extension does not exist, the GetFirstFile$ macro command will return a null string ('').  This command can be used to open and solve multiple EES files, as shown in the example, or to open and process multiple data files that are read into a lookup table.  The ,RECURSE parameter is optional. If it is provided, this command will look in all subdirectorires contained within the current subdirectory and include ALL files in all subdirectories in the list.

 

 Example: {open and solve all EES files in a directory}

 SetDirectory('d:\testmacro')

 F$=GetFirstFile$(*.ees)

 if (F$='') then quit

 repeat

     Open   F$

     solve

     pause 1

     F$=GetNextFile$

 until (F$='')

 

 

GetNextFile$

GetNextFile$ can only be used after the GetFirstFile$ macro command.  It returns the next file in the directory having the file name extension supplied in the GetFirstFile$ command.  Each use of the GetNextFile$ command will increment an internal counter and return the following file name in the directory.  After the last file is found, a following call to GetNextFile$ will return a null string ('').  See the above example. Only one set of GetFirstFile$/GetNextFile$ can be active in a macro, i.e., nested use is prohibited.  

 

MacroCommands