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

"^Cancel", "&Cancel", "Cancel" what they mean in PushButton()

Expand Messages
  • maryshi_us
    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,
    Message 1 of 4 , Oct 11, 2006
    • 0 Attachment
      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")"
    • Santosh Kumar
      In PushButton function, ^Cancel - Button name Cancel starting with with C . &Cancel - Button name Cancel , &Cancel happens to be in case if
      Message 2 of 4 , Oct 12, 2006
      • 0 Attachment
        In PushButton function,
        "^Cancel" -> Button name "Cancel" starting with with "C".
        "&Cancel" -> Button name "Cancel", "&Cancel" happens to be in case if the button has "Alt+C" as keyboard as shortcut.
        "Cancel" -> Button name "Cancel", that's all.. no short cuts no Regx.

        PushButton("Cancel") should work with notepad.

        I explored Notepad with various options to save or open, but I didn't come across any butt Cancel buttons with Alt+C short cut.
        let me know what exactly you are trying to do.

        Hope this helps.
        ~Santosh kumar



        ----- Original Message -----
        From: maryshi_us
        To: perlguitest@yahoogroups.com
        Sent: Thursday, October 12, 2006 5:45 AM
        Subject: [perlguitest] "^Cancel", "&Cancel", "Cancel" what they mean in PushButton()


        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")"





        [Non-text portions of this message have been removed]
      • Piotr Kaluski
        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
        Message 3 of 4 , Oct 12, 2006
        • 0 Attachment
          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")"
          >
        • 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 4 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.