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

Re: Unable to press buttons in the MSPaint application

Expand Messages
  • pkaluski
    What exactly did you try? Can you send us your code? -Piotr ... brush, ... many
    Message 1 of 5 , May 23, 2005
    • 0 Attachment
      What exactly did you try?
      Can you send us your code?
      -Piotr

      --- In perlguitest@yahoogroups.com, "vikas mehan" <vikas_mehan@i...>
      wrote:
      > Hi,
      > Can anyone tell me how to press the buttons (for eg, pencil,
      brush,
      > eraser etc) on the left side toolbar. I have tried a lot and spent
      many
      > hours but all in vain.
      > Pls help!!
      >
      >
      > Vikas
    • vikas mehan
      Following is the code: use Win32::GuiTest; # Start the app. system( start /max mspaint ); $window = Win32::GuiTest::WaitWindow( Paint , 5);
      Message 2 of 5 , May 23, 2005
      • 0 Attachment
        Following is the code:

        use Win32::GuiTest;

        # Start the app.
        system("start /max mspaint");
        $window = Win32::GuiTest::WaitWindow("Paint", 5);
        Win32::GuiTest::SetForegroundWindow($window);
        sleep 1;
        # Click the Brush button (controlID: 627) on the toolbar
        &SingleClickThatButtonInWindow(627, $window);

        # Draw a line using the selected brush
        Win32::GuiTest::MouseMoveAbsPix(300,200);
        Win32::GuiTest::SendMouse("{LEFTDOWN}");
        sleep 1;
        Win32::GuiTest::MouseMoveAbsPix(300,250);
        Win32::GuiTest::SendMouse("{LEFTUP}");

        sub SingleClickThatButtonInWindow
        {
        my (@Buttons);
        @Buttons = Win32::GuiTest::FindWindowLike ($_
        [1], "", "Button");
        # This gives 16 for those 16 toolbar buttons
        print $#Buttons+1, "\n";
        Win32::GuiTest::PushButton ($_[0], 0.5);
        }


        Pls help.

        vikas


        --- In perlguitest@yahoogroups.com, "pkaluski" <pkaluski@p...> wrote:
        > What exactly did you try?
        > Can you send us your code?
        > -Piotr
        >
        > --- In perlguitest@yahoogroups.com, "vikas mehan"
        <vikas_mehan@i...>
        > wrote:
        > > Hi,
        > > Can anyone tell me how to press the buttons (for eg, pencil,
        > brush,
        > > eraser etc) on the left side toolbar. I have tried a lot and
        spent
        > many
        > > hours but all in vain.
        > > Pls help!!
        > >
        > >
        > > Vikas
      • pkaluski
        Hi, There are some questionable parts in your code. 1. Where did you get 627 number from? How did you figure out that this is a control ID of the brush button?
        Message 3 of 5 , May 24, 2005
        • 0 Attachment
          Hi,
          There are some questionable parts in your code.
          1. Where did you get 627 number from? How did you figure out that
          this is a control ID of the brush button?
          2. Look at the code below:

          sub SingleClickThatButtonInWindow
          {
          my (@Buttons);
          @Buttons = Win32::GuiTest::FindWindowLike ($_[1], "", "Button");
          # This gives 16 for those 16 toolbar buttons
          print $#Buttons+1, "\n";
          Win32::GuiTest::PushButton ($_[0], 0.5);
          }

          Does FindWindowLike really return 16 toolbar buttons? How is that
          possible? What windows version are you using?

          Please have a look on my post #705. It may help.

          -Piotr


          --- In perlguitest@yahoogroups.com, "vikas mehan" <vikas_mehan@i...>
          wrote:
          > Following is the code:
          >
          > use Win32::GuiTest;
          >
          > # Start the app.
          > system("start /max mspaint");
          > $window = Win32::GuiTest::WaitWindow("Paint", 5);
          > Win32::GuiTest::SetForegroundWindow($window);
          > sleep 1;
          > # Click the Brush button (controlID: 627) on the toolbar
          > &SingleClickThatButtonInWindow(627, $window);
          >
          > # Draw a line using the selected brush
          > Win32::GuiTest::MouseMoveAbsPix(300,200);
          > Win32::GuiTest::SendMouse("{LEFTDOWN}");
          > sleep 1;
          > Win32::GuiTest::MouseMoveAbsPix(300,250);
          > Win32::GuiTest::SendMouse("{LEFTUP}");
          >
          > sub SingleClickThatButtonInWindow
          > {
          > my (@Buttons);
          > @Buttons = Win32::GuiTest::FindWindowLike ($_
          > [1], "", "Button");
          > # This gives 16 for those 16 toolbar buttons
          > print $#Buttons+1, "\n";
          > Win32::GuiTest::PushButton ($_[0], 0.5);
          > }
          >
          >
          > Pls help.
          >
          > vikas
          >
          >
          > --- In perlguitest@yahoogroups.com, "pkaluski" <pkaluski@p...>
          wrote:
          > > What exactly did you try?
          > > Can you send us your code?
          > > -Piotr
          > >
          > > --- In perlguitest@yahoogroups.com, "vikas mehan"
          > <vikas_mehan@i...>
          > > wrote:
          > > > Hi,
          > > > Can anyone tell me how to press the buttons (for eg, pencil,
          > > brush,
          > > > eraser etc) on the left side toolbar. I have tried a lot and
          > spent
          > > many
          > > > hours but all in vain.
          > > > Pls help!!
          > > >
          > > >
          > > > Vikas
        • vikas mehan
          Thanks a lot Piotr. I have found the way after I also read Post #705. The links are also working. Thanks again for the fast action. vikas ...
          Message 4 of 5 , May 24, 2005
          • 0 Attachment
            Thanks a lot Piotr. I have found the way after I also read Post #705.
            The links are also working. Thanks again for the fast action.


            vikas

            --- In perlguitest@yahoogroups.com, "pkaluski" <pkaluski@p...> wrote:
            > Hi,
            > There are some questionable parts in your code.
            > 1. Where did you get 627 number from? How did you figure out that
            > this is a control ID of the brush button?
            > 2. Look at the code below:
            >
            > sub SingleClickThatButtonInWindow
            > {
            > my (@Buttons);
            > @Buttons = Win32::GuiTest::FindWindowLike ($_[1], "", "Button");
            > # This gives 16 for those 16 toolbar buttons
            > print $#Buttons+1, "\n";
            > Win32::GuiTest::PushButton ($_[0], 0.5);
            > }
            >
            > Does FindWindowLike really return 16 toolbar buttons? How is that
            > possible? What windows version are you using?
            >
            > Please have a look on my post #705. It may help.
            >
            > -Piotr
            >
            >
            > --- In perlguitest@yahoogroups.com, "vikas mehan"
            <vikas_mehan@i...>
            > wrote:
            > > Following is the code:
            > >
            > > use Win32::GuiTest;
            > >
            > > # Start the app.
            > > system("start /max mspaint");
            > > $window = Win32::GuiTest::WaitWindow("Paint", 5);
            > > Win32::GuiTest::SetForegroundWindow($window);
            > > sleep 1;
            > > # Click the Brush button (controlID: 627) on the toolbar
            > > &SingleClickThatButtonInWindow(627, $window);
            > >
            > > # Draw a line using the selected brush
            > > Win32::GuiTest::MouseMoveAbsPix(300,200);
            > > Win32::GuiTest::SendMouse("{LEFTDOWN}");
            > > sleep 1;
            > > Win32::GuiTest::MouseMoveAbsPix(300,250);
            > > Win32::GuiTest::SendMouse("{LEFTUP}");
            > >
            > > sub SingleClickThatButtonInWindow
            > > {
            > > my (@Buttons);
            > > @Buttons = Win32::GuiTest::FindWindowLike ($_
            > > [1], "", "Button");
            > > # This gives 16 for those 16 toolbar buttons
            > > print $#Buttons+1, "\n";
            > > Win32::GuiTest::PushButton ($_[0], 0.5);
            > > }
            > >
            > >
            > > Pls help.
            > >
            > > vikas
            > >
            > >
            > > --- In perlguitest@yahoogroups.com, "pkaluski" <pkaluski@p...>
            > wrote:
            > > > What exactly did you try?
            > > > Can you send us your code?
            > > > -Piotr
            > > >
            > > > --- In perlguitest@yahoogroups.com, "vikas mehan"
            > > <vikas_mehan@i...>
            > > > wrote:
            > > > > Hi,
            > > > > Can anyone tell me how to press the buttons (for eg,
            pencil,
            > > > brush,
            > > > > eraser etc) on the left side toolbar. I have tried a lot and
            > > spent
            > > > many
            > > > > hours but all in vain.
            > > > > Pls help!!
            > > > >
            > > > >
            > > > > Vikas
          Your message has been successfully submitted and would be delivered to recipients shortly.