OT: Windows Console Inverse

Fairlight fairlite at fairlite.com
Mon Jan 23 08:48:44 PST 2006


At Mon, Jan 23, 2006 at 09:33:35AM -0500 or thereabouts, 
suspect Kenneth Brody was observed uttering:
> 
> Why point to "edit" when you could point to filePro itself?  :-)

There is that.  :)

> There is an entire API for managing the console.  However, none of it
> includes "send this escape sequence to stdout, and further output to
> stdout will now be in a different color".  There is an API call
> (SetConsoleTextAttribute) which will set the color of text send to
> stdout, but it is an explicit API call.

The assertion was that it wasn't doable unless ansi.sys was loaded.  From
what you've just told me, this is incorrect.  Simply installing
Win32::Console and using it should work just fine.  Gee, it's like a
mini-curses for Windows consoles, reading the docs.  I used it for -one-
thing, previously--detaching the console from the perl app for GUI apps.
Looks like it's a lot more than that.  First time I bothered with the POD,
since for what I needed, the example was quite clear--one call.

I'd have to play with this to see if Windows does what I expect, but I'm
pretty sure it would let you mix print() and using Win32::Console to change
attributes at specific locations.  Internally, you could specify a
character sequence like \b or something for bold or \r for reverse, and
simply catch those and do the console code for the appropriate locations.
Not fun, but possible.

Just bear in mind that anyone running it would also need to install
Win32::Console--unless you compile your perl and it's automatically
included in the binary.  I have a commercial compiler.  Bob may want to
look at PAR.

mark->


More information about the Filepro-list mailing list