getting text from WinXP console

Mark T. nospam at nospam.com
Tue Mar 22 16:11:59 EST 2005


"Chris Maloof" <cjmaloof at gmail.com> wrote in message
news:ubir315f5lm15qh96tf9i2qiepqhfndne7 at 4ax.com...
> Hello,
>
> Does anyone know how I can read the ASCII text from a console window
> (from another application) in WinXP?  It doesn't sound like a major
> operation, but although I can find the window via pywin32, I haven't
> been able to do anything with it.  I'd really just like to get the
> window text into a string.
>
> By "console window", I mean the sort of thing that comes up when you
> run "command" (although this particular one is for the game NetHack).
>
> Thanks,
> Chris

Check out the Win32 Console functions on MSDN, such as AlocConsole(),
ReadConsoleOutput(), GetStdHandle().  I don't see an easy way to get the
screen buffer handle unless you are the process that owns the console,
however.

Mark





More information about the Python-list mailing list