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

Re: [perlguitest] Digest Number 445

Expand Messages
  • Chris McMahon
    This caught my eye... ... Here s the simplest case of a script to handle modal dialogs: use Win32::GuiTest qw(FindWindowLike GetWindowText SetForegroundWindow
    Message 1 of 1 , Dec 2, 2005
    • 0 Attachment
      This caught my eye...

      > 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.

      Here's the simplest case of a script to handle modal dialogs:


      use Win32::GuiTest qw(FindWindowLike GetWindowText
      SetForegroundWindow SendKeys);

      system (1, "my_script_that_coughs_up_modal_dialogs.whatever");
      while (1) { #INFINITE LOOP
      sleep 5; #CHECK FOR NEW WINDOW EVERY 5 SEC
      my @windows = FindWindowLike(0, "^Microsoft Internet Explorer"
      );
      for (@windows) {
      SetForegroundWindow($_); #BRING THE RIGHT WINDOW IN FOCUS JUST IN CASE
      SendKeys("{ENTER}");
      }
      }

      The secret is system(1,foo) that returns control to the calling
      script. This is a really, really interesting (undocumented) feature
      of Perl on Win32.

      -Chris
    Your message has been successfully submitted and would be delivered to recipients shortly.