Re: How to capture visible text from Command Window

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for the replies guys.

The reason i need to capture the console text is - I am trying to
write a .NET plug-in to be used in a automation tool liek QTP to
automate a console based legacy application. My intent there is send
some commands and verify the output received.

As Pete has mentioned, I also feel that OCR is one of the possible
option. I am trying that using MS Document Imaging COM component), but
there are other challenges.

Anyways, If i get a solution, I will post back.

-Av



On Sep 3, 9:33 pm, "Peter Duniho" <no.peted.s...@xxxxxxxxxxxxxxxxxx>
wrote:
On Thu, 03 Sep 2009 08:13:02 -0700, Avi <avi.i...@xxxxxxxxx> wrote:
Hi,

I need to capture visible text from a command line application for
some automation purpose. I have created functions using WIN32 API
functions GetForegroundWindow, GetWindowText, SendMessage etc.
[ Below is the functions I am using. ]

**Challenge I am facing is - when i try to get text from console
application it gives only the title message, other details are
missing. **

Since AFAIK Windows doesn't know anything about the text displayed in a  
console window, I doubt you can do this without much more complicated  
code.  You'd need to capture the actual image, and then perform some kind  
of optical-character-recognition algorithm on the image to convert it back  
to the original text.  Of course, there's no shortage of pitfalls in doing  
something like that, not the least of which is the problem of dealing with  
overlapping windows.

Normally, if you want the text output of a console application, you write  
a program that is the one that actually starts the process running the  
application, and which redirects the standard output and standard error  
streams to capture the text directly as the console application runs.  If  
you have control over the application being run, this is what you should  
do.

Pete

.



Relevant Pages

  • Re: How to capture visible text from Command Window
    ... Since AFAIK Windows doesn't know anything about the text displayed in a console window, I doubt you can do this without much more complicated code. ... You'd need to capture the actual image, and then perform some kind of optical-character-recognition algorithm on the image to convert it back to the original text. ... Normally, if you want the text output of a console application, you write a program that is the one that actually starts the process running the application, and which redirects the standard output and standard error streams to capture the text directly as the console application runs. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Performing Ping from within VB.Net
    ... Windows Console Application. ... You can not capture their output thru normal ... command console or command processor. ... You can easily test if a particular 'command' is writing to std i/o (thus ...
    (microsoft.public.vb.general.discussion)
  • 2.6.22.1-rt4 lockups
    ... As with -rt3, I was able to capture one more crash trace, via serial ... current 2.6.22.1-rt4 is still locking-up on my ix86 SMT/SMP boxes. ... Code: Bad EIP value. ... Complete serial console capture: ...
    (Linux-Kernel)
  • Re: PHP and running DOS bat files and capture console
    ... run a windows DOS.bat file and capture all of its console for further processing? ... Never mind.. ...
    (comp.lang.php)
  • Re: recommendations : image grabber, translator.
    ... > My apologies Steve: I was hasty. ... Having said that it does require a console ... capture whatever else you want. ... For all I know KDE might even have a "add command ...
    (alt.os.linux)