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

Help Required: On system function

Expand Messages
  • vishal_kharge
    Hello , I am getting the error Could not find Paint when I run the following script: use strict; use Win32::GuiTest qw(:ALL); system( start mspaint ); sleep
    Message 1 of 7 , Apr 29, 2005
    • 0 Attachment
      Hello ,

      I am getting the error "Could not find Paint" when I run the
      following script:

      use strict;

      use Win32::GuiTest qw(:ALL);

      system("start mspaint");

      sleep 2;
      my @windows = FindWindowLike(0, "Paint", "");
      die "Could not find Paint\n" if not @windows;


      I am using the ActivePerl for running the scripts.

      I think the statement: system("start mspaint"); is not getting
      executed.

      What may be the reason and how should I solve this problem.

      Regards,
      Vishal Kharge
    • pkaluski
      I would try giving it more time. Try to sleep for 10 seconds (instead of 2) and see if it helps -Piotr
      Message 2 of 7 , Apr 29, 2005
      • 0 Attachment
        I would try giving it more time. Try to sleep for 10 seconds (instead
        of 2) and see if it helps
        -Piotr




        --- In perlguitest@yahoogroups.com, "vishal_kharge"
        <vishal_kharge@y...> wrote:
        > Hello ,
        >
        > I am getting the error "Could not find Paint" when I run the
        > following script:
        >
        > use strict;
        >
        > use Win32::GuiTest qw(:ALL);
        >
        > system("start mspaint");
        >
        > sleep 2;
        > my @windows = FindWindowLike(0, "Paint", "");
        > die "Could not find Paint\n" if not @windows;
        >
        >
        > I am using the ActivePerl for running the scripts.
        >
        > I think the statement: system("start mspaint"); is not getting
        > executed.
        >
        > What may be the reason and how should I solve this problem.
        >
        > Regards,
        > Vishal Kharge
      • Dennis K. Paulsen
        Since you doubt system( start mspaint ); is getting executed, make sure you can go to Start Run and execute mspaint. On Windows ? and above it will be
        Message 3 of 7 , Apr 29, 2005
        • 0 Attachment
          Since you doubt system("start mspaint"); is getting executed, make
          sure you can go to Start > Run and execute mspaint. On Windows ?
          and above it will be called "pbrush" instead.

          As a side note, it is best practice to use WaitWindowLike() and if
          you still need to account for any user delays in "testing" you
          can "add" the sleep statement following the WaitWindowLike() call.

          Also, if problem persists check the return value of the system and
          print out the contents of the $! builtin variable to find more
          information.


          Regards,
          Dennis K. Paulsen


          --- In perlguitest@yahoogroups.com, "vishal_kharge"
          <vishal_kharge@y...> wrote:
          > Hello ,
          >
          > I am getting the error "Could not find Paint" when I run the
          > following script:
          >
          > use strict;
          >
          > use Win32::GuiTest qw(:ALL);
          >
          > system("start mspaint");
          >
          > sleep 2;
          > my @windows = FindWindowLike(0, "Paint", "");
          > die "Could not find Paint\n" if not @windows;
          >
          >
          > I am using the ActivePerl for running the scripts.
          >
          > I think the statement: system("start mspaint"); is not getting
          > executed.
          >
          > What may be the reason and how should I solve this problem.
          >
          > Regards,
          > Vishal Kharge
        • Michael Rabinovitz
          Vishal, Make sure you can launch mspaint from the command prompt. If you can t, you ll have to adjust your path. Alternatively, you could adjust your scripts
          Message 4 of 7 , May 1 8:44 PM
          • 0 Attachment
            Vishal,
            Make sure you can launch mspaint from the command prompt. If you
            can't, you'll have to adjust your path. Alternatively, you could
            adjust your scripts 'system' command to:
            system("start C:\\windows\\mspaint");
            (you might have to make alterations for your configuration) and see
            if your script now runs.

            Good luck,
            Mike

            --- In perlguitest@yahoogroups.com, "vishal_kharge"
            <vishal_kharge@y...> wrote:
            > Hello ,
            >
            > I am getting the error "Could not find Paint" when I run the
            > following script:
            >
            > use strict;
            >
            > use Win32::GuiTest qw(:ALL);
            >
            > system("start mspaint");
            >
            > sleep 2;
            > my @windows = FindWindowLike(0, "Paint", "");
            > die "Could not find Paint\n" if not @windows;
            >
            >
            > I am using the ActivePerl for running the scripts.
            >
            > I think the statement: system("start mspaint"); is not getting
            > executed.
            >
            > What may be the reason and how should I solve this problem.
            >
            > Regards,
            > Vishal Kharge
          • vishal_kharge
            Hello, I tried to use the following command: system( start C: windows mspaint ); But still giving the same error. How I need to adjust the path? Thanks,
            Message 5 of 7 , May 1 8:58 PM
            • 0 Attachment
              Hello,

              I tried to use the following command:

              system("start C:\\windows\\mspaint");

              But still giving the same error.

              How I need to adjust the path?

              Thanks,
              Vishal Kharge

              --- In perlguitest@yahoogroups.com, "Michael Rabinovitz"
              <rabinov@y...> wrote:
              > Vishal,
              > Make sure you can launch mspaint from the command prompt. If you
              > can't, you'll have to adjust your path. Alternatively, you could
              > adjust your scripts 'system' command to:
              > system("start C:\\windows\\mspaint");
              > (you might have to make alterations for your configuration) and see
              > if your script now runs.
              >
              > Good luck,
              > Mike
              >
              > --- In perlguitest@yahoogroups.com, "vishal_kharge"
              > <vishal_kharge@y...> wrote:
              > > Hello ,
              > >
              > > I am getting the error "Could not find Paint" when I run the
              > > following script:
              > >
              > > use strict;
              > >
              > > use Win32::GuiTest qw(:ALL);
              > >
              > > system("start mspaint");
              > >
              > > sleep 2;
              > > my @windows = FindWindowLike(0, "Paint", "");
              > > die "Could not find Paint\n" if not @windows;
              > >
              > >
              > > I am using the ActivePerl for running the scripts.
              > >
              > > I think the statement: system("start mspaint"); is not getting
              > > executed.
              > >
              > > What may be the reason and how should I solve this problem.
              > >
              > > Regards,
              > > Vishal Kharge
            • vishal_kharge
              Hello, By increasing the delay time, its still not working. Thanks, Vishal K ... (instead
              Message 6 of 7 , May 2 2:40 AM
              • 0 Attachment
                Hello,

                By increasing the delay time, its still not working.

                Thanks,
                Vishal K

                --- In perlguitest@yahoogroups.com, "pkaluski" <pkaluski@p...> wrote:
                > I would try giving it more time. Try to sleep for 10 seconds
                (instead
                > of 2) and see if it helps
                > -Piotr
                >
                >
                >
                >
                > --- In perlguitest@yahoogroups.com, "vishal_kharge"
                > <vishal_kharge@y...> wrote:
                > > Hello ,
                > >
                > > I am getting the error "Could not find Paint" when I run the
                > > following script:
                > >
                > > use strict;
                > >
                > > use Win32::GuiTest qw(:ALL);
                > >
                > > system("start mspaint");
                > >
                > > sleep 2;
                > > my @windows = FindWindowLike(0, "Paint", "");
                > > die "Could not find Paint\n" if not @windows;
                > >
                > >
                > > I am using the ActivePerl for running the scripts.
                > >
                > > I think the statement: system("start mspaint"); is not getting
                > > executed.
                > >
                > > What may be the reason and how should I solve this problem.
                > >
                > > Regards,
                > > Vishal Kharge
              • pkaluski
                Your original script worked for me. I have 2 questions: 1. What is the result of system function? Try this code: if( system( start mspaint ) ){ print Error
                Message 7 of 7 , May 2 11:04 AM
                • 0 Attachment
                  Your original script worked for me.

                  I have 2 questions:
                  1. What is the result of "system" function?
                  Try this code:
                  if( system( "start mspaint ) ){
                  print "Error from system function: $!";
                  }

                  2. Is Paint launched by your script?
                  If yes, can you send me a screenshot of a title bar of Paint (send it
                  to my private account, since yahoo groups do not accept attachments in
                  posts)

                  -Piotr

                  --- In perlguitest@yahoogroups.com, "vishal_kharge"
                  <vishal_kharge@y...> wrote:
                  > Hello,
                  >
                  > I tried to use the following command:
                  >
                  > system("start C:\\windows\\mspaint");
                  >
                  > But still giving the same error.
                  >
                  > How I need to adjust the path?
                  >
                  > Thanks,
                  > Vishal Kharge
                  >
                  > --- In perlguitest@yahoogroups.com, "Michael Rabinovitz"
                  > <rabinov@y...> wrote:
                  > > Vishal,
                  > > Make sure you can launch mspaint from the command prompt. If
                  you
                  > > can't, you'll have to adjust your path. Alternatively, you could
                  > > adjust your scripts 'system' command to:
                  > > system("start C:\\windows\\mspaint");
                  > > (you might have to make alterations for your configuration) and
                  see
                  > > if your script now runs.
                  > >
                  > > Good luck,
                  > > Mike
                  > >
                  > > --- In perlguitest@yahoogroups.com, "vishal_kharge"
                  > > <vishal_kharge@y...> wrote:
                  > > > Hello ,
                  > > >
                  > > > I am getting the error "Could not find Paint" when I run the
                  > > > following script:
                  > > >
                  > > > use strict;
                  > > >
                  > > > use Win32::GuiTest qw(:ALL);
                  > > >
                  > > > system("start mspaint");
                  > > >
                  > > > sleep 2;
                  > > > my @windows = FindWindowLike(0, "Paint", "");
                  > > > die "Could not find Paint\n" if not @windows;
                  > > >
                  > > >
                  > > > I am using the ActivePerl for running the scripts.
                  > > >
                  > > > I think the statement: system("start mspaint"); is not getting
                  > > > executed.
                  > > >
                  > > > What may be the reason and how should I solve this problem.
                  > > >
                  > > > Regards,
                  > > > Vishal Kharge
                Your message has been successfully submitted and would be delivered to recipients shortly.