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

Re: [perlguitest] Re: "^Cancel", "&Cancel", "Cancel" what they mean in PushButton()

Expand Messages
  • mary shi
    Hi Piotr, The modified code works fine. Great! Thanks, Mary Piotr Kaluski wrote: Hi, It is all about being in the foreground.
    Message 1 of 4 , Oct 16, 2006
    • 0 Attachment
      Hi Piotr,

      The modified code works fine. Great!

      Thanks,
      Mary

      Piotr Kaluski <pkaluski@...> wrote:
      Hi,
      It is all about being in the foreground. PushButton presses button in
      a window, which is in a foreground (is active and has input focus).
      In your example the window in the foreground is the window ... from
      which you launch your script.
      In order to do what you want, you have to attach to the popup and push
      the button on this popup. Try this:

      use strict;
      use Win32::GuiTest qw( :ALL );
      my @win=FindWindowLike(0, "Notepad");
      die "no notepad" if not @win;
      print"found\n" if @win;

      my $menu = GetMenu($win[0]);
      my $submenu = GetSubMenu($menu, 0);

      MenuSelect("&File|E&xit", $win[0], $menu);
      sleep(1);
      @win=FindWindowLike(0, "^Notepad");
      die "No popup" if not @win;
      print"found\n" if @win;
      PushChildButton($win[ 0 ], "Cancel");

      Hope this helps.

      --Piotr

      --- In perlguitest@yahoogroups.com, "maryshi_us" <maryshi_us@...> wrote:
      >
      > Now I am using PushButton(). This function seems not work correctly to
      > me. I checked example and found like "^Save","&OK",or "Yes" and I don't
      > understand. So, could somebady help me figure them out?
      >
      > I open Notepad and write some letters. My code:
      >
      > my @win=FindWindowLike(0, "Notepad");
      > die "no notepad" if not @win;
      > print"found" if @win;
      >
      > my $menu = GetMenu($win[0]);
      > my $submenu = GetSubMenu($menu, 0);
      >
      > MenuSelect("&File|E&xit", $win[0], $menu);
      > sleep(1);
      > PushButton("Cancel");
      >
      > But the result is that the popup window is stilled showed up. But it
      should
      > be closed by "PushButton("Cancel")"
      >






      ---------------------------------
      Stay in the know. Pulse on the new Yahoo.com. Check it out.

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