DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

COMMON SCRIPT FOR DIFFERENT FILE FORMATS

Solved!
Go to solution

Hi all,

 

I have a script which takes .dat file as input. Call DataFileLoad(strDataRawPath_, "DAT", "Load")

 

Now, I modified the string DAT to ANY so that it accepts any file format say .iso, .mme, etc....

 

But when i try to load the .iso file it pops a msg that particular file doesn't exixts. (I have installed iso plugin)

 

How can i make my script to accept multiple file formats??

 

 

0 Kudos
Message 1 of 11
(5,033 Views)

Hi,

try to leave the second parameter (FileImportFilter) empty, so DIAdem will try to choose the correct DataPlugin for you to load.

0 Kudos
Message 2 of 11
(5,031 Views)

Hi usac,

 

THis is not working for me. I am using the very big script  of about 5000 lines in which i have datafileload statement nearly 8 times. I repalced each  in each line from DAT to " ". But am getting pop up msg, fle cannot be found. I have attahed both script and test file in same location.

 

 Call DataFileLoad(strDataRawPath_, "DAT ", "Load")

Call DataFileLoad(strDataProPath_ & "_Processed", "DAT", "Load")

Call DataFileLoad(strDataProPath_ & "_Processed", "DAT", "Load")

Call DataFileLoad(strDataProPath_ & "_Processed", "DAT", "Load")    to load processed data..

 

I replaced all DAT with "", but no use.. Can some one suggest me how can i do this??

0 Kudos
Message 3 of 11
(5,014 Views)

Hi,

sorry for being unclear.

Please try to usethe command as follows:

Call DataFileLoad(strDataRawPath_, , "Load")

Leaving the parameter completely empty is different in contrast to passing an empty string.

 

Greetings

0 Kudos
Message 4 of 11
(5,010 Views)

Hi RSH,

 

Passing the "" parameter will work as well-- either way you're instructing DIAdem to use the DataPlugin associated with the file extension, which is the same thing that happens when you drag&drop from the NAVIGATOR into the Data Portal.  I'd be inclined to believe the error message that the script can't find the data file.  If you have the script and the data file in the same folder, then you can use the AutoActPath variable to pass the correct folder information to form the full file path, which is ALWAYS a good idea.

 

Call DataFileLoad(AutoActPath & "FileName.DAT", "", "Load")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 11
(4,969 Views)

Hi Brad,

 

Am using,

 

Call FileNameGet("ANY", "FileRead", AutoActPath, "", "", 0, "Select File to Process...")

 If DlgState = "IDCancel" Then Call AutoQuit

Call DataFileLoad(AutoActPath & "FileName.DAT", "", "Load")

 

Am i supposed to use like this?? Fila name get with ANY followed with datafileload...

 

And the highlighted text in red only loads that particular filename. If i want to load any file with any data format( .mme, .iso, .dat, .egv) , All located in same folder, how do i do that??

 

Will the above statements still work for this??

 

Not to confuse you, My idea is to load any file type when i run my script. It should nt be restricted only to .dat or .mme... Provided all scripts and data files in same location...

 

Many thanks,

RSH

 

 

 

 

0 Kudos
Message 6 of 11
(4,944 Views)

Hi RSH,

 

That's the right approach to load one file of an arbitrary file type, using DIAdem's file extension DataPlugin association list-- the same one you use when you drag&drop from the NAVIGATOR into the Data Portal.

 

In order to load multiple files from one folder, you'll need to build an array of all those files.  I have code to do this that I can send you, but do you really want to try to load ALL files in that folder?  What if there are *.doc or *.pdf files in that folder?  Isn't there a short list of file extensions that are valid, say *.DAT,*.MME,*TDM,*.TDMS?

 

Do you just want all the data files on one folder level, or in all the subfolders of that parent folder as well?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 7 of 11
(4,930 Views)

Brad,

 

To be more Clear..

In my C:/> I have Scripts Folder, inside which I have Test DB folder. Like this.

C:\ Scripts \ Test DB

 

I have my scripts in Scripts Folder. And all test files in (*.iso, *.dat, *.egv file samples).

 

I want to test my script for all type of test samples. Hence I load any 1 type of file each time.

 

I will not load all type of files at a time.

 

Now I can successfully test my scripts to load .dat files. Now If i try to load *.iso (or) *.egv, what I should do??

 

Should I keep changing my script  adding "iso" and ".egv" in datafileload( ,  ,  ,)  function for each file type??

 

What is the best way to achieve this??

0 Kudos
Message 8 of 11
(4,876 Views)

Hi RSH,

 

There are a variety of ways to address this scenario.  In your case I think I'll recommend that you make 2 copies of your VBScript, resulting in one for each file type, and edit them accordingly:

 

Load All ISO Data Files.VBS

Load All DAT Data Files.VBS

Load All EGV Data Files.VBS

 

This way you can easily pick which file type to load, and you only have to make the script edits once.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 11
(4,871 Views)

Brad,

 

Is this the only way to load different files.. Can't i have a single script to load differewnt types of files??

 

I want to have a single copy of my script.. from which i can load files of different format which I select through the load window..

0 Kudos
Message 10 of 11
(4,862 Views)