Re: [PHP-DOC] Coloured console output support for windows.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2009 at 4:38 AM, Richard Quadling
<rquadling@xxxxxxxxxxxxxx> wrote:
> 2009/9/21 Hannes Magnusson <hannes.magnusson@xxxxxxxxx>:
>> On Mon, Sep 21, 2009 at 12:59, Richard Quadling
>> <rquadling@xxxxxxxxxxxxxx> wrote:
>>> doing, it can be done quite easily using the REG command from the
>>> Windows Resource Toolkit.
>>>
>>> REG ADD "HKLM\Software\Microsoft\Command Processor" /v AutoRun /t
>>> REG_SZ /d "C:\Utils\ANSICon.exe -p"
>>
>> Right, but that has to be done when installing the application, not
>> every time phd.bat is executed.
>
> Agreed. And the ANSICON instructions could easily be amended to show this.
>
>
>> And we would also have to detect if the system supports it rather then
>> blindly polluting the registry.
>
> "blindly polluting the registry" ?
>
> From cmd /? ...
>
> "If /D was NOT specified on the command line, then when CMD.EXE starts, it
> looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
> either or both are present, they are executed first.
>
>    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
>
>        and/or
>
>    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun"
>
>
> This is "blindly polluting", but a completely standard and supported
> facility, albeit an obscure one.
>
> As for detection, once ANSICON is loaded,  the ANSICON environment variable.
>
> But maybe ANSICon needs a small installer which has the option of
> doing this (Jason - possible?) automatically for those too nervous of
> editing registry.
>
>>
>> Plus, afaik, the PEAR installer doesn't support doing such things.
>>
>
> !is_null(getenv('ANSICON')) ?
>
>> -Hannes
>>
>
> I think that whilst windows no longer has coloured console output as
> standard, a free alternative is a viable option.

Windows does indeed support colored console output. You have a few
options to accomplish this without installing 3rd party programs:use
the DOS subsystem, you can program in 16bit assembly using interrupts
(which will just get launched in the DOS subsystem), or use Windows
API to output text in colored format. Microsoft has dropped support
for DOS interrupts in the 32bit console unfortunately and replaced it
with goofy API that you have to call : (. Now, I could just be talking
through my teeth but I am 99% sure of what I said (at least for
Windows OS based on the NT kernel such as 2K/XP, I have very little
experience with Vista so I can't comment).

See the following KB article for more info
http://support.microsoft.com/kb/101875

>
> The other option is to disable coloured output when on windows, but if
> that was the case, I would like the option of having a mechanism to
> enable this without having to add it to the command line every time -
> yet another env_var?
>
> The source is available. Jason has been very receptive to the issues
> that I've raised.
>
> Richard
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

My 2 cents anyways.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux