getFileName
Top  Previous  Next

val = getFileName (integer Index, [ string Path ="*.*" ] )

Returns the name of the file that matches specified conditions.

Parameters
 
Index  
 
An integer specifying an ordinal number of the file in the group of files that match the condition given by the Path parameter.  
 
Path  
 
A string that contains a target file specification. May include the path to a folder and wildcards. If the path is omitted, the default directory will be used. See setCurDir for more details.  
Default value: "*.*"  
 
Return value
 
A string containing the name of the file matching the specified conditions.  
 
Error flags
 
ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Remark
 
The specified path should comply with the standard notations for directory names in Windows operating system. When you use the optional backslash character (\) in paths, you must place two backslashes (\\) in a string to represent a single backslash (\). If the drive letter is omitted in Path, the default directory will be used as a reference.  
 
Examples
 
The following code prints names of the files in the sample folder.  
 
setCurDir("samples")  
count=getFileCount()  
For I=0 to count  
 Print getFileName(I)  
Next  
 
The following code waits for an image file to appear in a folder to start processing it:  
 
fMask="*.iwd"  
setCurDir("c:\\images")  
do  
 'wait for image  
 while getFileCount(fMask)=0  
  wait(10)  
 wend  
 'process  
 fName=getFileName(1, fMask)  
 print fName  
 loadIm(1, fName)  
 'remove from queue  
 delFile(fName)  
 sobel (1,2)  
loop