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

Re: best wishes!

Expand Messages
  • brentje
    Yes, please send in your script. I ve been working on something to do this for the last couple of days. I ve finally got something to work. But to quote a
    Message 1 of 5 , Dec 2, 2005
    • 0 Attachment
      Yes, please send in your script. I've been working on something to do
      this for the last couple of days. I've finally got something to work.
      But to quote a certain sci-fi movie...this has got to be the ugliest
      hack I've ever done.

      I've made a master script. After checking to see if the foreground
      window is the right window to test on, I create a process. Then I
      start a loop that just checks every half second to make sure the
      foreground window is still the right window. If it's not, it suspends
      the process. Then it checks the window title of the new foreground
      window to see if it matches a known error message that could popup for
      the window. If a match is found, I direct it to handle the error,
      kill the process, then create a new process to start the script again.
      If it's not, for now I just have it dying. With a little work, I
      think this could do what I want it to do. But I would be more then
      appreciative for some suggestions.

      Here's a copy of my code for everyone to improve. Since I'm testing
      .Net, and .Net has strange ways of creating error dialogs appearently,
      I have to search the foreground window to get the title text. And I
      know the hardcoded mouse click is bad, as is the multiple process
      creation code, but this was a quick proof-of-concept test.


      Win32::Process::Create($ProcessObj,
      "C:\\Perl\\bin\\perl.exe",
      "perl Login.pl",
      0,
      NORMAL_PRIORITY_CLASS,
      ".")|| die ErrorReport();

      while (1)
      {
      select(undef, undef, undef, 0.50);
      $fgWindow = GetForegroundWindow();
      if($fgWindow != $myWindow)
      {
      $ProcessObj->Suspend();
      select(undef, undef, undef, 2.00);
      if(FindWindowLike($fgWindow, "Invalid User", undef))
      {
      MouseMoveAbsPix(507,406);
      SendMouse('{LEFTCLICK}');
      $ProcessObj->Kill( 9 );
      Win32::Process::Create($ProcessObj,
      "C:\\Perl\\bin\\perl.exe",
      "perl Login.pl",
      0,
      NORMAL_PRIORITY_CLASS,
      ".")|| die ErrorReport();
      }elsif(FindWindowLike($fgWindow, "Password Error", undef))
      {
      MouseMoveAbsPix(507,406);
      SendMouse('{LEFTCLICK}');
      $ProcessObj->Kill( 9 );
      Win32::Process::Create($ProcessObj,
      "C:\\Perl\\bin\\perl.exe",
      "perl Login.pl",
      0,
      NORMAL_PRIORITY_CLASS,
      ".")|| die ErrorReport();
      }else
      {
      $ProcessObj->Kill( 9 );
      die;
      }
      }
      }


      Thanks
      Brent


      --- In perlguitest@yahoogroups.com, "Piotr Kaluski" <pkaluski@p...> wrote:
      >
      > Could you please send us those scripts?
      > --Piotr
      >
      > --- In perlguitest@yahoogroups.com, "Danny R. Faught" <faught@t...>
      > wrote:
      > >
      > > I have a script that does some kludging around with
      > GetForegroundWindow and GetWindowText to detect modal error dialogs.
      > It does a fairly reliable job of getting past them.
      > >
      > > I haven't tried to detect non-modal dialogs.
      > > --
      > > Danny R. Faught
      > > Tejas Software Consulting
      > > http://tejasconsulting.com/
      > >
      >
    • Philip Zembrod
      ... My approach: I scan for new top level windows 10 times per second and have the rule: Every unexpected new top level window is an error. Thus in my test
      Message 2 of 5 , Dec 5, 2005
      • 0 Attachment
        > Date: Thu, 01 Dec 2005 15:30:46 -0600
        > From: "Danny R. Faught" <faught@...>
        > Subject: Re: best wishes!
        >
        > I have a script that does some kludging around with GetForegroundWindow and GetWindowText to detect modal error dialogs. It does a fairly reliable job of getting past them.
        >
        > I haven't tried to detect non-modal dialogs.

        My approach: I scan for new top level windows 10 times per second and have the rule:
        Every unexpected new top level window is an error. Thus in my test scripts I have to
        announce expected dialogs or message boxes before I click the button or menu item
        that triggers them. This works fine for me.

        Regards
        Philip
      Your message has been successfully submitted and would be delivered to recipients shortly.