DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Load all .tdms files from filder using .vbs

Hello,

 

I have 17 data files (.tdms) stored in local folder. In my script, now, I use --Call DataFileLoad(autoactpath&test1&".tdms","TDMS","Register") to load all files (run this command x17 times with different input :test1,test2...test17). Is any method to load automatically this data ? I want to keep my variabile name (test1,test2...) just to not modify all script.

 

Now, my script is kind of:

 

test1= InputBox("File name no. 1")

test2= InputBox("File name no. 2")

.......................................................

 

Call DataFileLoad(autoactpath&test1&".tdms","TDMS","Register")

------do someting----------

Data.Root.ChannelGroups.Remove("Data")

 

Call DataFileLoad(autoactpath&test2&".tdms","TDMS","Register")

------do someting----------

 

And so on. 

 

Thank you in advance.

0 Kudos
Message 1 of 4
(711 Views)

Hi Alex_SI,

 

You can try this script:

 

dim sSearchFolder, sFileListArray, iLoop, sFullFileName

sSearchFolder  = "d:\Test\xxx\"
sFileListArray = DirLstWrite(sSearchFolder, "*.TDM", "filename", , 0, "FullFilenames")

for each sFullFileName in sFileListArray
  call Data.Root.Clear
  call DataFileLoad(sFullFileName)
  ' do something
next

 

Greetings

Walter

Message 2 of 4
(705 Views)

Thank you so much. All works fine.

 

Could you also help me with print a report ? 

Or should I open new topic?

0 Kudos
Message 3 of 4
(664 Views)

Hi Alex_SI,

 

You can enable the recording mode in DIAdem to get command for scripting like:

 

Walter_Rick_0-1677738836653.png

 

  • enable the recording mode
  • select script language (VBS or Python)
  • do something
  • disable the recording mode

 

All relevant script commands are recorded in SCRIPT

 

Greetings

Walter

0 Kudos
Message 4 of 4
(650 Views)