Console color handling by twapi.

Posted by vish on 2011-05-07 06:11

Hi,

How can i handle console's color (either background or foreground) for each line of the console output.

This can handle by twapi of active state????

Help me in this. I badly needed this.

Thanks,
Vish

vish | Sun, 2011-05-08 21:33

Thanks for your support I got the solution.

Install latest tcl
It won't be having twapi package by default.So you have to install this using teacup
For installation of twapi you have to connect your machine to internet then execute command
"teacup install twapi"

make sure you can able to import twapi package

steps for getting colored output
==================================================
##import package twapi
% package require twapi

##get handler of console
% set hndl [twapi::get_console_handle stdout]

##set console foreground color to red
% twapi::_set_console_default_attr $hndl fgred 1
==================================================

regards,
vish