LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display tokens in text file

Hello All;
 
I am working on some text file update VI's, and I am having quite a bit of trouble with tokens...
 
In order to get all my offsets and such correct, I need to input a text file (using Read From Text File), but I want to display all tokens with the text. I've played around with the Scan String for Tokens VI, but cannot get it to do what I want it to.
 
I am attaching a sample text file.  Is there a quick way of doing this?  (i.e. read from file, put into string, scan entire string and output same string with both text and tokens visible)...
 
Thanks.
D. J. Hanna
0 Kudos
Message 1 of 6
(3,193 Views)
Hi Hannamon,

your example text file cries for using "config file" (aka ini-file) functions! They can be found in their own subfolder of the file palette...
And there are some examples coming with LabView too! (Search for "configuration".)

Message Edited by GerdW on 10-25-2007 03:41 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,188 Views)

Hi All;

True, I did create the original text file using the Config File VIs, however! my need for a text file editor has outgrown their usefulness; perhaps I should have explained my full application intent:

I have a text-based configuration file that is used by multiple software platforms, and is already in existence.  I am not versed in these platforms, and so my platform of choice is LabVIEW.  I need to pull certain configuration and variable information from these text-based files and use them in my LabVIEW application.  These text-based files are set up in a format significantly different that would be useful in a Config VI, and I do not have the option of reformatting the text-based file to suit my needs.  Think of it as a "one text-file format for all applications" type of idea.

Hence the need to identify the string tokens as part of my original post.  (GerdW: normally a good idea, I agree!  But I hope my explanation clarifies my current need.)

DJH

0 Kudos
Message 3 of 6
(3,166 Views)
Hi Hannamon,

then you shouldn't attach a text file that definitely looks like an ini-file Smiley Wink
When you can't use the config file functions you have to program all their possibilieties on your own Smiley Sad

Well, I would try to use the string functions (like Scan from string, Match pattern, Spreadsheet string to array,...).
See the attachment to get a clue.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,148 Views)
Thanks, GerdW;
 
Sorry about the initial confusion; for me it was more of a "next logical step" from config vi to a general text file reader 😉
 
I think the spreadsheet string to array.vi will probably be an easier route for me to go, since each line item contains system information, and I can just parse it accordingly!  I'll give it a go, and update the thread on my progress.  Thanks for the example!
 
Regards,
D. J. Hanna
0 Kudos
Message 5 of 6
(3,135 Views)

Just to close out the thread, the Spreadsheet String to Array turned out to be what I needed... this handled the eol quite nicely, and I only had to reverse the process to write the file.  Thanks!

DJH

0 Kudos
Message 6 of 6
(3,099 Views)