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

Re: [perlguitest] Re: Another issue of Win32::Guitest hanging

Expand Messages
  • Lee Marlin
    Thanks for the confirmation and all the great code examples. I had a similar problem with SaveAs and invented the following companion process to get around
    Message 1 of 6 , Aug 3, 2005
    • 0 Attachment
      Thanks for the confirmation and all the great code examples. I had a similar problem with "SaveAs" and invented the following companion process to get around it.

      The original application starts this code prior to performing a SaveAs for an HTML document. Worked great.

      Lee
      # =========================================================
      use Win32::GuiTest qw ( :ALL :SW );

      my $messageClass = "^#32770";
      my $SaveHTML = "^Save HTML Document";
      @SaveAswins = FindWindowLike( 0, $SaveHTML, $messageClass );
      die unless scalar @SaveAswins == 1 && IsWindow($SaveAswins[0]);
      print "FindWindowLike SaveAswins - found " . @SaveAswins . " window(s).\n";
      print "SaveAswins=$SaveAswins[0]\n";

      SetForegroundWindow($SaveAswins[0]);
      Win32::GuiTest::SendKeys("{TAB}{TAB}{ENTER}");
      Win32::GuiTest::SendKeys("{ENTER}");



      "Dennis K. Paulsen" <ctrondlpaulsden@...> wrote:

      Yeah, that's it. Just the way the Windows message box works. There
      are several ways around this (spawning external script, write custom
      message box routine, etc, etc.), but beyond the scope of this forum
      and the time I have lately. :-(

      Regards.

      --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...>
      wrote:
      > It looks that Win32::MsgBox does not return until something is
      > pressed. You should not have any problems finding a handle of any
      > message box created by other process.
      > -Piotr
      >
      > --- In perlguitest@yahoogroups.com, "lmarlin" <lmarlin@y...> wrote:
      > > This test script is similar to the Beach Bobby one of majingaa2z
      > > posted this week:
      > >
      > > Script is:
      > >
      > >
      > > use Win32;
      > >
      > > use Win32::GuiTest qw(:ALL);
      > >
      > > $Win32::GuiTest::debug = 1; # Set to "1" to enable verbose mode
      > >
      > > $result = Win32::MsgBox("something is DOWN",48,'test');
      > >
      > > my @windows = FindWindowLike(undef, 'test');
      > >
      > > if( !@windows )
      > > {
      > > die "Cannot find window with title/caption\n";
      > > }
      > > else
      > > {
      > > printf( "Window handle of application is %x\n", $windows[
      0 ] );
      > > sleep 2;
      > >
      > > SetForegroundWindow($windows[0]);
      > >
      > >
      > > my @children = GetChildWindows($windows[0]);
      > > SetForegroundWindow( $children[ 0 ] );
      > > SetFocus ( $children[ 0 ] );
      > >
      > > SendKeys("{ENTER}");
      > > # PushButton ("OK");
      > >
      > >
      > > }
      > >
      > > Environment: Windows XP SP2
      > > Win32::GuiTest-1.50.3-ad
      > >
      > > Behavior:
      > >
      > > When run from the command prompt, (perl script.pl)
      > > the message box displays but Perl never executes the
      FindWindowLike.
      > >
      > > If you click on the OK button in the message box, the
      > FindWindowLike
      > > fires (and fails) since the window it was supposed to find is
      gone.
      > >
      > > It makes no difference if you try:
      > >
      > > my @windows = FindWindowLike(0, 'test'); instead
      > >
      > > Is there an obvious goof here?
      > >
      > > or
      > >
      > > Any ideas about how to either find the handle for the message
      box
      > > and set focus to it other than FindWindow or FindWindowLike?
      > >
      > > (Apologizing in advance if this is too trivial a question)?





      ---------------------------------
      YAHOO! GROUPS LINKS


      Visit your group "perlguitest" on the web.

      To unsubscribe from this group, send an email to:
      perlguitest-unsubscribe@yahoogroups.com

      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


      ---------------------------------



      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.