Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Documentation TCANSI error

samintz

Scott Mintz
May
1,582
27
I didn't see any checkboxes in the Tcmd Option dialog for TCANSI, so I manually edited my tcmd.ini file.

I set ANSI=No in the [4NT] section and added TCANSI=Yes in the [TakeCommand] section.

I got the following startup error
upload_2016-7-26_17-12-33.png


So I changed the named from TCANSI to ANSI and that fixed it.

The help file has this text:
INI Directives:



TCANSI=NO|yes - Enable ANSI escape sequence support for all console applications running in Take Command tab windows. Take Command will inject a dll (ANSI32.dll or ANSI64.dll) into the console applications it starts. Note that if you have enabled TCANSI in Take Command, you should disable ANSI support in TCC (OPTION / Windows).
 
Under "Tabs" there's an "ANSI Colors" checkbox. I checked it back when the feature was announced. In TCMD.INI I have two of "ANSI=Yes", one in the "4NT" section, one in the "TakeCommand" section.
 
This is really cool. I have a PROMPT that uses ANSI to colorize my prompt. And every time I launch CMD from within TCC (or a batch script that leaves me in CMD after it runs) I always got this really ugly prompt because of the escape sequences in the prompt that got inherited but not evaluated.

Now I get a colorized prompt in CMD also! Now if I can figure out how to dynamically change the color...

Code:
prompt=`^e[37;%@if[%@remote[%_disk] eq 0,42,41];1m[$P]^e[33;40;1m$s`

CMD doesn't like the %@if[] in the prompt. I use it to change the background color of the $P to red for network drives and green for local drives.
 
I figured it out.
Code:
reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d "%%USERPROFILE%%\autoexec.cmd" /f
echo @prompt=$e[37;44;1m[$P]$e[33;40;1m$s>%USERPROFILE%\autoexec.cmd

I changed the background color to blue when running in CMD. Very nice. Thank you for that suggestion.
 
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.
upload_2016-7-26_18-31-12.png

upload_2016-7-26_18-31-51.png

upload_2016-7-26_18-32-36.png
 
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.

CMD.EXE has always done that, AFAIK. I don't think it has anything to do with Take Command or TCC. You're just more likely to notice when starting CMD.EXE from TCC because TCC makes it easier to display multiple colors in the first place.
 
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.

No surprise. That prompt is history ... already in the console screen buffer.

TCMD isn't doing the interpretation of the ANSI sequences. CMD is ... because ANSI.DLL has been injected into it. If you have the means, you can inject it manually and do the same thing without TCMD. Here's an example in a real console. 2828 is CMD's PID.

upload_2016-7-26_19-37-26.png
 

Similar threads

Back
Top