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

Send Keys Question

Expand Messages
  • pc210018
    I am trying to use the sendkeys function from within a perl TK program. If the window that I am sending the keystokes to is not the active window, the
    Message 1 of 3 , Dec 6, 2001
    • 0 Attachment
      I am trying to use the sendkeys function from within a perl TK
      program. If the window that I am sending the keystokes to is not the
      active window, the keystrokes are not received. If it is the active
      window, it works fine.
      I installed via PPM this module today. It looks like what is in the
      repository is version .9 not the latest 1.3.
      I tried adding the line
      ShowWindow($window,1);
      to the code below to see if this would bring the destination window
      to the top. But it does not.
      Is the any documentation for these extra functions?


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

      $title='Remedy User.*';
      $window = FindWindowLike (0,$title)
      SetForegroundWindow($window);
      SendKeys("Starting Order");

      Thanks
      Phil
      pc210018@...
    • erngui
      Hi, ... [...] ... the ... Sounds strange. The ppm installer uses the local .tar.gz file that comes with the distribution. I just downloaded from cpan and the
      Message 2 of 3 , Dec 7, 2001
      • 0 Attachment
        Hi,

        --- In perlguitest@y..., "pc210018" <pc210018@n...> wrote:
        [...]
        > I installed via PPM this module today. It looks like what is in
        the
        > repository is version .9 not the latest 1.3.

        Sounds strange. The ppm installer uses the local .tar.gz file that
        comes with the distribution. I just downloaded from cpan and the .pm
        file inside the .tar.gz file says 1.3, so I'd say the distribution
        looks ok. Any chance your problem is caused by something else?

        > I tried adding the line
        > ShowWindow($window,1);
        > to the code below to see if this would bring the destination window
        > to the top. But it does not.
        > Is the any documentation for these extra functions?

        No. I'm working on it, but mostly the "documentation" is the sample
        programs in the "eg" directory.

        > $title='Remedy User.*';
        > $window = FindWindowLike (0,$title)
        > SetForegroundWindow($window);
        > SendKeys("Starting Order");

        My guess is you're working on Windows 2000.

        MS changed the way SetForegroundWindow works: in previous versions of
        the OS, if you had a menu open and a program/window comes to the
        foreground, the menu closes, which a lot of people found anoying. In
        W2000 the window doens't actually become the foreground window,
        instead the icon in the taskbar starts to flash...

        This is bad for SendKeys and at the moment, the only way I've found
        around it is to use SendKeys to send ALT+TAB get 2000 to switch
        windows this way...

        Regards,
        Ernesto.
        --
        Ernesto Guisado
        mailto:erngui@...
        http://triumvir.org
      • erngui
        Hi, just looked up some links that describe this problem: INFO: SetActiveWindow() and SetForegroundWindow() Clarification
        Message 3 of 3 , Dec 7, 2001
        • 0 Attachment
          Hi,

          just looked up some links that describe this problem:

          INFO: SetActiveWindow() and SetForegroundWindow() Clarification
          http://support.microsoft.com/support/kb/articles/Q97/9/25.ASP

          INFO: Changing the Foreground Window in Windows 98 and Windows 2000
          http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q227043

          HTH,
          Ernesto.
          --
          Ernesto Guisado
          mailto:erngui@...
          http://triumvir.org
        Your message has been successfully submitted and would be delivered to recipients shortly.