Jon99 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Copy text from a window
by Fletch (Bishop) on Mar 03, 2009 at 14:50 UTC

    That's so sad. I need a pony.

    Read How (Not) To Ask A Question and perhaps provide a miniscule scintilla of context (at a minimum the frelling OS in question, for instance) and you might actually get something remotely resembling a helpful answer.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Copy text from a window
by wfsp (Abbot) on Mar 03, 2009 at 15:55 UTC
    Adapted from BrowserUk's snippet.

    This will print the text from any open Notepad window.
    See Win32::GuiTest and Win32::Clipboard.

    #!/usr/bin/perl use warnings; use strict; use Win32::GuiTest qw[FindWindowLike SendKeys SetForegroundWindow]; use Win32::Clipboard; my $clip = Win32::Clipboard(); for my $w (FindWindowLike(undef, qr{ - Notepad$}, undef, undef, undef) +){ SetForegroundWindow($w); SendKeys(q{^A^C}); print $clip->Get(); }
    update1: removed a debugging print statement
    update2: fixed link
      Thnx, it really works for Notepad. But what I want to do is to copy from an application, that has a child-window with text in it. The coping of this text is limited with the copy/paste procedure.
Re: Copy text from a window
by Anonymous Monk on Mar 03, 2009 at 14:51 UTC