XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).
Moderator: General Moderators
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Wed Feb 13, 2008 6:15 pm
Does anyone know if the windows cmd.exe can display ANSI color escape sequences using the same code as under UNIX-like systems?
Could someone with a windows machine give this a little test for me?
Run on command line:
Code: Select all
<?php
echo "First : \033[31m Fail \033[0m" . PHP_EOL;
echo "Second : \033[32m OK \033[0m" . PHP_EOL;
echo "Third : \033[31m\033[1m Exception \033[0m" . PHP_EOL;
echo "Fourth : \033[34m\033[1m Skip \033[0m" . PHP_EOL;
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Wed Feb 13, 2008 6:45 pm
Windows wrote: First : ←[31m Fail ←[0m
Second : ←[32m OK ←[0m
Third : ←[31m←[1m Exception ←[0m
Fourth : ←[34m←[1m Skip ←[0m
(#10850)
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Wed Feb 13, 2008 7:04 pm
*sigh*
Thanks man
xpt
Forum Newbie
Posts: 23 Joined: Tue Feb 20, 2007 1:00 pm
Post
by xpt » Fri Feb 15, 2008 3:01 pm
Chris Corbyn wrote: Does anyone know if the windows cmd.exe can display ANSI color escape sequences using the same code as under UNIX-like systems?
Back to the old DOS days, one can display ANSI color escape sequences, and cursor reallocation too, provided that the
is included in the config.sys
Haven't been playing with DOS/Windows for nearly 10 years, and I don't know what's the status now...
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Mon Feb 18, 2008 6:21 pm
Ah, I was just coming back here to ask about ansi.sys. Thanks for the reply
It seems that windows does require this device driver to be loaded before it will display ansi color (wtf???). My windows knowledge is completely zilch when it comes to this type of thing, but does anyone know some kind of COM check I can run to determine if I can display ansi colors? I can get by with just displaying plain black/white if it's not loaded, but since it displays those silly backspace chars without it I'll need to do a check.
If push comes to shove I'll just check if PHP_OS looks like windows and disable color if so.
It's not for anything important... just the CLI interface to a test runner:
Attachments
test-runner.png (44.96 KiB) Viewed 5160 times
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Wed Feb 20, 2008 8:15 pm
In theory, it should be possible to use COM to get the effect we want. Researching right now...
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Wed Feb 20, 2008 9:31 pm
Gave up, but here's what I found:
1. COM is one possibility, but I couldn't figure out how to directly interface with the COM to manipulate the Console
2. Next, I turned to scripting with COM, but Console didn't seem to be defined in Jscript
3. Finally, I tried instantiating the System.Console dot-net class, but PHP fatally errored on me.
Whee...
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Thu Feb 21, 2008 5:39 am
Hey thanks for trying man! I guess windows users will just have to live with black and white.