Hi K9,
Walter's suggestion is to use the DIAdem command "DirLstWrite()" to create an ASCII file with the names of the files in a particular directory, then use serial evaluation to sequentially load and analyze those files, using the ASCII file to determine which data files to load.
There are cases where serial evaluation is not flexible enough-- you might, for instance, want to load all the data files at once and calculate some statisical quantities which cut across all the data files. For this case, you can either read in the ASCII file generated with the "DirListWrite()" command, or you can use the following VBScript functionality to get a (1-indexed) array of the file paths within a particular start directory:
StartDir = "C:\"
FileExts = "txt|asc|dll" ' example list of selected file extensions
FileExts = "*"
FilePaths = FileListInDir(StartDir, FileExts)
MsgBox Join(FilePaths, vbCRLF)
'-------------------------------------------------------------------------------------
'******* FileListInDir() *** *** NEW Function ***
'-------------------------------------------------------------------------------------
Function FileListInDir(Directory, FileExtStr)
Dim k, f, fc, fso, file, ExtComp, ExtStr, DotPos, FileListStr, FileExts
FileExts = Split("|" & FileExtStr, "|")
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(Directory) Then FileListInDir = Array("") : Exit Function
Set f = fso.GetFolder(Directory)
Set fc = f.Files
FOR k = 1 TO UBound(FileExts)
ExtComp = UCase(Trim(FileExts(k)))
For Each file In fc
DotPos = InStrRev(file.Name, ".")
ExtStr = UCase(Trim(Mid(file.Name, DotPos+1)))
IF ExtStr = ExtComp OR ExtComp = "*" THEN
FileListStr = FileListStr & "|" & file.Path
END IF
Next ' file
NEXT ' k
FileListInDir = Split(FileListStr, "|")
End Function ' FileListInDir()
Hope that helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments