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

Sending keys to application thr scheduler

Expand Messages
  • Jangale V-S
    Hi all, I want to sendkeys to application thr scheduler ! The application is open in user s login and scheduler service is running in administrative login ! I
    Message 1 of 4 , Jun 19, 2002
    • 0 Attachment
      Hi all,

      I want to sendkeys to application thr scheduler !
      The application is open in user's login and
      scheduler service is running in administrative login !

      I scheduled following script in scheduler



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

      $Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode

      my @windows = FindWindowLike(0, "^SmartPlant Review -", "");

      die "You should start SPR before running this example.\n"
      unless @windows;

      foreach (@windows) {

      print "$_>\t'", GetWindowText($_), "'\n\n";
      $test = SetForegroundWindow($_);
      SendKeys("%fx~{PAUSE 1000}");
      }


      The program prints title of window properly but fails to bring it to
      foreground
      and fails to send keys !!


      Any suggestions ??

      With Best Regards,

      Vidyadhar
    • erngui
      Hi, ... As I posted here http://groups.yahoo.com/group/perlguitest/message/13 Win2K doesn t allow SetFore* unless you re the thread that created the window. If
      Message 2 of 4 , Jun 19, 2002
      • 0 Attachment
        Hi,

        --- In perlguitest@y..., Jangale V-S <v-s.jangale@s...> wrote:
        > $test = SetForegroundWindow($_);

        As I posted here

        http://groups.yahoo.com/group/perlguitest/message/13

        Win2K doesn't allow SetFore* unless you're the thread that created
        the window.

        If you're using Win2K you'll have to use SenKeys to send an ALT+TAB
        sequence that allows switching between applications.

        Regards,
        Ernesto.
        -- Ernesto Guisado, erngui@..., http://triumvir.org
      • Jangale V-S
        Hi, I tried switching between windows by using SendKeys( %{TAB}{PAUSE 1000} ); in a loop ! However program keeps on switching between first two windows only !
        Message 3 of 4 , Jun 20, 2002
        • 0 Attachment
          Hi,

          I tried switching between windows by using

          SendKeys("%{TAB}{PAUSE 1000}");

          in a loop !

          However program keeps on switching between
          first two windows only !

          How to make it switch thr all open windows ??

          Thanks in advance !

          With Best Regards,

          V.S. Jangale

          -----Original Message-----
          From: erngui [mailto:erngui@...]
          Sent: 2002-06-19 22:28
          To: perlguitest@yahoogroups.com
          Subject: [perlguitest] Re: Sending keys to application thr scheduler


          Hi,

          --- In perlguitest@y..., Jangale V-S <v-s.jangale@s...> wrote:
          > $test = SetForegroundWindow($_);

          As I posted here

          http://groups.yahoo.com/group/perlguitest/message/13
          <http://groups.yahoo.com/group/perlguitest/message/13>

          Win2K doesn't allow SetFore* unless you're the thread that created
          the window.

          If you're using Win2K you'll have to use SenKeys to send an ALT+TAB
          sequence that allows switching between applications.

          Regards,
          Ernesto.
          -- Ernesto Guisado, erngui@..., http://triumvir.org
          <http://triumvir.org>




          To unsubscribe from this group, send an email to:
          perlguitest-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
          <http://docs.yahoo.com/info/terms/> .
        • erngui
          Hi, ... Yes, you would need to keep alt down while sending several sequential tab keys. The problem is that SendKeys doesn t allow that. If you download the
          Message 4 of 4 , Jun 20, 2002
          • 0 Attachment
            Hi,

            --- In perlguitest@y..., Jangale V-S <v-s.jangale@s...> wrote:
            > I tried switching between windows by using
            >
            > SendKeys("%{TAB}{PAUSE 1000}");
            >
            > in a loop !
            >
            > However program keeps on switching between
            > first two windows only !

            Yes, you would need to keep alt down while sending several sequential
            tab keys. The problem is that SendKeys doesn't allow that. If you
            download the latest version (see 1.49.1 in the files section), you
            can do this:

            use Win32::GuiTest qw/:FUNC :VK/;

            SendRawKey(VK_MENU, 0);
            SendKeys("{TAB}{PAU 1000}{TAB}{PAU 1000}{TAB}");
            SendRawKey(VK_MENU, KEYEVENTF_KEYUP);

            The PAUSE commands are only there so that you can see what's going on.

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