Loading ...
Sorry, an error occurred while loading the content.

Re: copying the text

Expand Messages
  • Dennis K. Paulsen
    Hello, You could use SendKeys( {TAB} ) to switch focus between the two text fields. Also, Win32::Clipboard may work okay for retrieving the text back from the
    Message 1 of 2 , May 14, 2003
    • 0 Attachment
      Hello,

      You could use SendKeys("{TAB}") to switch focus between the two text
      fields. Also, Win32::Clipboard may work okay for retrieving the
      text back from the clipboard.

      Pseudo Code:
      1. Ensure focus is set to text field 1
      2. Select All (^a)
      3. Copy (^c) the data into clipboard
      4. Retrieve data back from clipboard (Win32::ClipBoard, $CB->Get())
      5. Store the data in file
      Repeat for text field 2

      Regards,
      Dennis K. Paulsen

      --- In perlguitest@yahoogroups.com, "Rajeev J" <jrajeev@f...> wrote:
      > I have a web page which has 2 huge text fields in that , what i am
      > trying to do in perl is copy the content in these edit fields and
      paste
      > it into a different file and then would do operation on the file.
      >
      > for doing the same(copying from the web page) i am using the script
      > below which uses ^a and ^c to copy the content to the clipboard,
      but
      > here what is happening is that it copies the content form both the
      edit
      > fields , how do i copy the content of the first text field first
      and
      > then pass the focus to the second text field and copy that
      >
      > Please let me what should be done extra , here or in case you have
      a
      > different method to accomplish this
      >
      >
      >
      >
      =====================================================================
      ===
      > ===============
      > #! perl -w
      > # vim: ts=4
      >
      > use strict;
      > use Win32::GuiTest qw/
      > PushButton
      > FindWindowLike
      > SetForegroundWindow
      > SendKeys
      > WaitWindow
      > IsWindow
      > WMGetText
      >
      > /;
      >
      > my @windows = WaitWindow("C2DTestP.htm");
      > SetForegroundWindow($windows[0]);
      > SendKeys("^a");
      > SendKeys("^c");
      > SendKeys("^v");
      > my $text = WMGetText($windows[0]) ;
      > print $text;
      >
      =====================================================================
      ===
      > ========
    Your message has been successfully submitted and would be delivered to recipients shortly.