LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I write to text file colorful texts

I save system events in a text file,for example when system give warning message i want to write it red

0 Kudos
Message 1 of 7
(3,848 Views)

A raw text file does not have any formatting.  Maybe you could write to a Word document and format it in there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,842 Views)

ASCII does not support text color, or any other style settings.  You can make custom reporting like using HTML or Word to have formatting.

0 Kudos
Message 3 of 7
(3,841 Views)

As others have said, a standard text file has no formatting. If you want to avoid a formatted language however, you could always put a keyword at the start of each appropriate line (so warning: text detailing the warning or error: text detailing the error) then write a specific reader to give you the colours. The reader could be in LabVIEW or just an add on into something like notepad++ without too much fuss.

 

So a programmed reader would look at the first line up until the :, then depending on the text beforehand colour the line appropriatly.

0 Kudos
Message 4 of 7
(3,822 Views)

You could add "rich text" tags, name the file *.rtf, and open it in wordpad.

0 Kudos
Message 5 of 7
(3,809 Views)

You could also add HTML tags and open the file in a browser.

0 Kudos
Message 6 of 7
(3,805 Views)

As others have mentioned, if you want to view text in different colors with an viewer/editor tool outside of LabVIEW, you must provide the necessary formatting for that tool.

 

If it works for your application to view the file using LabVIEW you can do this:

 

1) Place a unique key in each line that identifies an error.

2) Display the text in a Listbox and color each line based on that unique key.

 

You can fairly easily provide a stand alone viewer if needed.

This technique can also be expanded to provide multiple colors.

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 7
(3,781 Views)