Forum > General

strip color from TProcess output [solved]

(1/2) > >>

Michael Collier:
Hi

I use TProcess to execute nodejs application, which in turn outputs characters which I'm guessing are for colour control.

The colours don't show up in lazarus memo, I'll try pasting below but may not paste properly, I guess I could scan the output and strip characters within certain range, has anyone done this before? Or suggest different component to display console output?

'TEXT_HERE'

marcov:
Those are probably so called ansi escape codes. Google and find out....

Roland57:
Hi.

If I were you, I would execute one time the application with redirection of the output to a file, so that I have a good sample of the output. After that I would write a function for cleaning the output, maybe using regular expressions.

Or I would check if the application hasn't an option to disable colored output.

Michael Collier:
I guess I'll have to strip the codes out. I've tried using online package manager to install rich edit controls  to display the colours (rather than stripping them out). But in each case the IDE reports that a file cannot be found (I'm on linux at the moment) - despite including the relevant package and being able to drop the control on a form at design time.

packages:
LazRichView
RichMemo

Roland57:
I don't believe that these components (RichMemo, LazRichView) can be useful in that case.

Navigation

[0] Message Index

[#] Next page

Go to full version