NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to load a text file (ASCII) into a TS string variable?

I need to load a ASCII file into a TS string variable for subsequent processing. I tried the SecuenceBuilder DLL (in the examples directory) but it seems that this DLL has a bug. Some text files are not loaded properly. I have also tried the kernel32 functions (openfile, createfile, readfile ... ) handling them as a C program, but with no success. The property loader feature of TS is not the suitable solution for me, because I would have to modify all my text files to include some specific fields (step name, variables, starmarker ...). Doy you know an alternative procedure to load text files or any DLL that implements what I look for ? Any help would be grateful. Cesar (yoocesar@yahoo.es)
0 Kudos
Message 1 of 5
(4,880 Views)
I don't know of a way to do it with any of the built steps in TestStand. I do it as a step written in LabVIEW and it's trivial. It's just as easy with CVI. What language do you use for development?
0 Kudos
Message 2 of 5
(4,880 Views)
Thank you very much for your answer. I use TS to control a third-party (and propietary) application, not made by NI. Interfacing between both applications is done via a DLL Flexible Adapter, with very simple commands as put,get... and similar. My aim is to find a procedure, program or DLL, like SequenceBuilder.dll, to load a Textfile into a string variable. With Sequencebuilder dll is really easy, but it doesn´t work fine. I tried the Kernel32.dll resources as well but with no success. I have seen that with Labview is really easy, but I don´t use. I´ll continue my search in this matter. Have a nice day. César
0 Kudos
Message 3 of 5
(4,880 Views)
Hi Cesar,

I don't know if you have found a solution, but attached is a DLL built in VC that will read the text out of a file into a TestStand variable. The attached sequence file \SequenceFile1.seq contains a step type that is set to call the DLL responsible for reading the file. It reads the file specified under Step.FilePath and stores the data in Step.ReadData. Please let me know if this works for you. I have attached the source as well.

Regards,

Bob
Message 4 of 5
(4,880 Views)
You can do it by calling the CVI functions "CVI_OpenFile", "CVI_ReadFile" and "CVI_CloseFile" directly from "cvirt.dll" (Windows2000 and I guess NT have it in c:\winnt\system32). The attached file shows an example to read a file named "d:\temp\Text1.txt". Hope this helps.
Message 5 of 5
(4,880 Views)