DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

useFileList and Split function issues

I'm having a frustrating problem getting what I thought would be an easy task to work.  I've exhausted the excellent help system, and now turn to the experts.

 

The following script is designed to merely ask the user which files to process.  The expectation is that multiple files will be selected...

 

'Create Calculations Group for all file-analysis results
CalculationsGroupName = GroupCreate("Calculations")
Call GroupDefaultSet(GroupIndexGet(CalculationsGroupName))

' Get List of Filennames to process
Call FileNameGet("ANY", "FileRead", DataReadPath, "AirCompData (*.tdm),*.tdm", "AirCompStopStart", True, "Select Files to Process")
RequestedFileNames = Split(FileDlgFileName,"|")

 

' Determine Number of Files
L1 = UBound(RequestedFileNames) + 1

 

A few lines down, I call another script, in which the following code executes...

 

CurrentFile = useFileList
DestinationFolder = DlgOutputPath
ChannelSize = 0
StopCommandRunTime = 0

'Load Next File in List
Call MsgBoxDisp ("Now loading data file " & L2 & " of " & L1 & ":" & Chr(13) & CurrentFile & Chr(13) & "Hit Esc to exit", "MB_NoButton", "MsgTypeInformation", 0, 0, 1,0)
Call DATAFILELOAD(CurrentFile)
L2 = L2 + 1

 

My problem is that the variable RequestedFileNames shows only" ???" when I place it in the watch window.  The Ubound correctly identifies the number of files correctly, but "useFileList shows "", a null string.  Hence an error when excuting the DATAFILELOAD function.

 

Help, I wrote 90% of my task in about an hour...and have lost 4 hours trying to get this to work.  Its probably something simple, but as mentioned, its not coming to me through the help system. 

 

If you need more info to help, just let me know.

 

Thanks in advance.

 

Jeff Grimes

Message Edited by JeffGrimes on 06-03-2009 10:22 AM
0 Kudos
Message 1 of 4
(3,998 Views)

OK, it hit me immediately this time...Tried again, and reviewing the help caught that the useFileList filename MUST be same name as the executing script file...with a lst extension.  That fixed the useFile List issue.

 

But, the RequestedFileNames variable showing ??? in the watch window...whats up with that?

0 Kudos
Message 2 of 4
(3,993 Views)

Hi Jeff,

 

The VBScript debugger in DIAdem-SCRIPT will not show you the contents of array or object variables. This is what I use for a multi-selection file dialog:

 

DlgTitle = "Insert File Dialog Title Here..."

StartPath = ProgramDrv & "Libr\Dat\"

FileExts = "*.DAT;*.TDM"

Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)

FilePaths = Split("|" & FileDlgFileName,"|")

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 4
(3,965 Views)
 
0 Kudos
Message 4 of 4
(3,954 Views)