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

RE: [perlguitest] Re: Quake Console Update Unreliable

Expand Messages
  • Chris Hilton
    I thought about suggesting this before, but it s a good bit more complicated. Trying to keep it as simple as possible, I believe it would be something like
    Message 1 of 9 , Jul 20 9:04 AM
    • 0 Attachment
      I thought about suggesting this before, but it's a good bit more
      complicated. Trying to keep it as simple as possible, I believe it would be
      something like this:

      foreach $letter (split(//, $text)) {
      $vk = getVirtualKey($letter);
      SendMessage($window, WM_KEYDOWN, $vk, 1);
      SendMessage($window, WM_KEYUP, $vk, 1);
      }

      With getVirtualKey() and looking up the constant values left as exercises
      for the reader. Note that if you want to send a two-key combination, like a
      capital letter for the following example, you'll need to send a key down
      message for the virtual shift key, send your letter, then key up the virtual
      shift key. Here's some URLs that might come in handy.

      SendMessage:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
      /WindowsUserInterface/Windowing/MessagesandMessageQueues/MessagesandMessageQ
      ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
      <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
      I/WindowsUserInterface/Windowing/MessagesandMessageQueues/MessagesandMessage
      QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
      WM_KEYDOWN:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
      /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboar
      dInputMessages/WM_KEYDOWN.asp
      <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
      I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboa
      rdInputMessages/WM_KEYDOWN.asp>
      WM_KEYUP:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
      /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboar
      dInputMessages/WM_KEYUP.asp
      <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
      I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboa
      rdInputMessages/WM_KEYUP.asp>
      Virtual Key Codes:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
      /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
      <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
      I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>

      I think it's a bit of overkill unless you've tried the other way and found
      it lacking, but good luck.

      Chris Hilton

      -----Original Message-----
      From: coolrobd [mailto:coolrobd@...]
      Sent: Tuesday, 20 July, 2004 07:22
      To: perlguitest@yahoogroups.com
      Subject: [perlguitest] Re: Quake Console Update Unreliable


      SendMessage is definately the way to go I feel, but how do you pass a
      letter using SendMessage, any syntax would be appreciated.

      I know you can only send one letter at a time.

      Thanks in advance!

      Rob






      [Non-text portions of this message have been removed]
    • coolrobd
      Naerly there I think - Just can t get then SendMessage to work. Do I need to setup the WM_KEYDOWN? Also getVirtialKey does not work - just wondering if you
      Message 2 of 9 , Jul 20 2:11 PM
      • 0 Attachment
        Naerly there I think - Just can't get then SendMessage to work. Do
        I need to setup the WM_KEYDOWN?

        Also getVirtialKey does not work - just wondering if you where
        expecting me to knock up the code behind it?

        Cheers for the help.

        --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
        wrote:
        > I thought about suggesting this before, but it's a good bit more
        > complicated. Trying to keep it as simple as possible, I believe it
        would be
        > something like this:
        >
        > foreach $letter (split(//, $text)) {
        > $vk = getVirtualKey($letter);
        > SendMessage($window, WM_KEYDOWN, $vk, 1);
        > SendMessage($window, WM_KEYUP, $vk, 1);
        > }
        >
        > With getVirtualKey() and looking up the constant values left as
        exercises
        > for the reader. Note that if you want to send a two-key
        combination, like a
        > capital letter for the following example, you'll need to send a
        key down
        > message for the virtual shift key, send your letter, then key up
        the virtual
        > shift key. Here's some URLs that might come in handy.
        >
        > SendMessage:
        > http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinUI
        > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
        dMessageQ
        > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
        > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinU
        >
        I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
        Message
        > QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
        > WM_KEYDOWN:
        > http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinUI
        > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
        e/Keyboar
        > dInputMessages/WM_KEYDOWN.asp
        > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinU
        >
        I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
        /Keyboa
        > rdInputMessages/WM_KEYDOWN.asp>
        > WM_KEYUP:
        > http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinUI
        > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
        e/Keyboar
        > dInputMessages/WM_KEYUP.asp
        > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinU
        >
        I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
        /Keyboa
        > rdInputMessages/WM_KEYUP.asp>
        > Virtual Key Codes:
        > http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinUI
        > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
        > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
        us/winui/WinU
        > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
        >
        > I think it's a bit of overkill unless you've tried the other way
        and found
        > it lacking, but good luck.
        >
        > Chris Hilton
        >
        > -----Original Message-----
        > From: coolrobd [mailto:coolrobd@y...]
        > Sent: Tuesday, 20 July, 2004 07:22
        > To: perlguitest@yahoogroups.com
        > Subject: [perlguitest] Re: Quake Console Update Unreliable
        >
        >
        > SendMessage is definately the way to go I feel, but how do you
        pass a
        > letter using SendMessage, any syntax would be appreciated.
        >
        > I know you can only send one letter at a time.
        >
        > Thanks in advance!
        >
        > Rob
        >
        >
        >
        >
        >
        >
        > [Non-text portions of this message have been removed]
      • Chris Hilton
        Yeah, that s what I meant by getVirtualKey() and looking up the constant values left as exercises for the reader . You ll need to write getVirtualKey() to
        Message 3 of 9 , Jul 21 9:04 AM
        • 0 Attachment
          Yeah, that's what I meant by "getVirtualKey() and looking up the constant
          values left as exercises for the reader". You'll need to write
          getVirtualKey() to convert letters to virtual keys. You'll also need the
          constant values for WM_KEYDOWN, WM_KEYUP, and the virtual key codes (from
          winuser.h, I think) and, I would recommend, set them up as constants in your
          Perl program.

          use constant WM_KEYDOWN => <whatever>;
          use constant WM_KEYUP => <whatever>;

          Chris Hilton

          -----Original Message-----
          From: coolrobd [mailto:coolrobd@...]
          Sent: Tuesday, 20 July, 2004 16:11
          To: perlguitest@yahoogroups.com
          Subject: [perlguitest] Re: Quake Console Update Unreliable


          Naerly there I think - Just can't get then SendMessage to work. Do
          I need to setup the WM_KEYDOWN?

          Also getVirtialKey does not work - just wondering if you where
          expecting me to knock up the code behind it?

          Cheers for the help.

          --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
          wrote:
          > I thought about suggesting this before, but it's a good bit more
          > complicated. Trying to keep it as simple as possible, I believe it
          would be
          > something like this:
          >
          > foreach $letter (split(//, $text)) {
          > $vk = getVirtualKey($letter);
          > SendMessage($window, WM_KEYDOWN, $vk, 1);
          > SendMessage($window, WM_KEYUP, $vk, 1);
          > }
          >
          > With getVirtualKey() and looking up the constant values left as
          exercises
          > for the reader. Note that if you want to send a two-key
          combination, like a
          > capital letter for the following example, you'll need to send a
          key down
          > message for the virtual shift key, send your letter, then key up
          the virtual
          > shift key. Here's some URLs that might come in handy.
          >
          > SendMessage:
          > http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinUI
          > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
          dMessageQ
          > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
          > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinU
          >
          I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
          Message
          > QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
          > WM_KEYDOWN:
          > http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinUI
          > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
          e/Keyboar
          > dInputMessages/WM_KEYDOWN.asp
          > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinU
          >
          I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
          /Keyboa
          > rdInputMessages/WM_KEYDOWN.asp>
          > WM_KEYUP:
          > http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinUI
          > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
          e/Keyboar
          > dInputMessages/WM_KEYUP.asp
          > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinU
          >
          I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
          /Keyboa
          > rdInputMessages/WM_KEYUP.asp>
          > Virtual Key Codes:
          > http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinUI
          > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
          > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
          <http://msdn.microsoft.com/library/default.asp?url=/library/en->
          us/winui/WinU
          > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
          >
          > I think it's a bit of overkill unless you've tried the other way
          and found
          > it lacking, but good luck.
          >
          > Chris Hilton
          >
          > -----Original Message-----
          > From: coolrobd [mailto:coolrobd@y...]
          > Sent: Tuesday, 20 July, 2004 07:22
          > To: perlguitest@yahoogroups.com
          > Subject: [perlguitest] Re: Quake Console Update Unreliable
          >
          >
          > SendMessage is definately the way to go I feel, but how do you
          pass a
          > letter using SendMessage, any syntax would be appreciated.
          >
          > I know you can only send one letter at a time.
          >
          > Thanks in advance!
          >
          > Rob
          >
          >
          >
          >
          >
          >
          > [Non-text portions of this message have been removed]



          Yahoo! Groups Sponsor

          ADVERTISEMENT

          <http://us.ard.yahoo.com/SIG=1293586lr/M=295196.4901138.6071305.3001176/D=gr
          oups/S=1705006951:HM/EXP=1090488476/A=2128215/R=0/SIG=10se96mf6/*http://comp
          anion.yahoo.com> click here

          <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
          :HM/A=2128215/rand=781724395>


          _____

          Yahoo! Groups Links


          * To visit your group on the web, go to:
          http://groups.yahoo.com/group/perlguitest/
          <http://groups.yahoo.com/group/perlguitest/>


          * To unsubscribe from this group, send an email to:
          perlguitest-unsubscribe@yahoogroups.com
          <mailto:perlguitest-unsubscribe@yahoogroups.com?subject=Unsubscribe>


          * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
          <http://docs.yahoo.com/info/terms/> .




          [Non-text portions of this message have been removed]
        • coolrobd
          Back to basic s I am afraid, I have looked into it and just can t figure it out, it just will not work, so now trying to get the calculator to accept keys,
          Message 4 of 9 , Jul 21 2:05 PM
          • 0 Attachment
            Back to basic's I am afraid, I have looked into it and just can't
            figure it out, it just will not work, so now trying to get the
            calculator to accept keys, still no joy, check out the attached
            code, looks good to me, but does not work. The setting up of the
            window works great, its just the SendMessage that does not work.

            use Win32::GuiTest qw(FindWindowLike SendMessage
            SetForegroundWindow ) ;

            use constant WM_KEYDOWN => 0x0100;
            use constant WM_KEYUP => 0x0101;

            my ($hwnd) = FindWindowLike(0, "Calculator");
            print "hwnd = $hwnd\n";
            SetForegroundWindow($hwnd);
            $test = SendMessage($hwnd, WM_KEYDOWN, 0x32, 1);
            print "test = $test\n";
            $test2 = SendMessage($hwnd, WM_KEYUP, 0x32, 1);
            print "test2 = $test2\n";

            --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
            wrote:
            > Yeah, that's what I meant by "getVirtualKey() and looking up the
            constant
            > values left as exercises for the reader". You'll need to write
            > getVirtualKey() to convert letters to virtual keys. You'll also
            need the
            > constant values for WM_KEYDOWN, WM_KEYUP, and the virtual key
            codes (from
            > winuser.h, I think) and, I would recommend, set them up as
            constants in your
            > Perl program.
            >
            > use constant WM_KEYDOWN => <whatever>;
            > use constant WM_KEYUP => <whatever>;
            >
            > Chris Hilton
            >
            > -----Original Message-----
            > From: coolrobd [mailto:coolrobd@y...]
            > Sent: Tuesday, 20 July, 2004 16:11
            > To: perlguitest@yahoogroups.com
            > Subject: [perlguitest] Re: Quake Console Update Unreliable
            >
            >
            > Naerly there I think - Just can't get then SendMessage to work.
            Do
            > I need to setup the WM_KEYDOWN?
            >
            > Also getVirtialKey does not work - just wondering if you where
            > expecting me to knock up the code behind it?
            >
            > Cheers for the help.
            >
            > --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
            > wrote:
            > > I thought about suggesting this before, but it's a good bit more
            > > complicated. Trying to keep it as simple as possible, I believe
            it
            > would be
            > > something like this:
            > >
            > > foreach $letter (split(//, $text)) {
            > > $vk = getVirtualKey($letter);
            > > SendMessage($window, WM_KEYDOWN, $vk, 1);
            > > SendMessage($window, WM_KEYUP, $vk, 1);
            > > }
            > >
            > > With getVirtualKey() and looking up the constant values left as
            > exercises
            > > for the reader. Note that if you want to send a two-key
            > combination, like a
            > > capital letter for the following example, you'll need to send a
            > key down
            > > message for the virtual shift key, send your letter, then key up
            > the virtual
            > > shift key. Here's some URLs that might come in handy.
            > >
            > > SendMessage:
            > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinUI
            >
            > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
            > dMessageQ
            > > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
            > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinU
            > >
            >
            I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
            > Message
            > >
            QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
            > > WM_KEYDOWN:
            > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinUI
            >
            > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
            > e/Keyboar
            > > dInputMessages/WM_KEYDOWN.asp
            > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinU
            > >
            >
            I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
            > /Keyboa
            > > rdInputMessages/WM_KEYDOWN.asp>
            > > WM_KEYUP:
            > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinUI
            >
            > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
            > e/Keyboar
            > > dInputMessages/WM_KEYUP.asp
            > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinU
            > >
            >
            I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
            > /Keyboa
            > > rdInputMessages/WM_KEYUP.asp>
            > > Virtual Key Codes:
            > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinUI
            > > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
            > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
            > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
            > us/winui/WinU
            > > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
            > >
            > > I think it's a bit of overkill unless you've tried the other way
            > and found
            > > it lacking, but good luck.
            > >
            > > Chris Hilton
            > >
            > > -----Original Message-----
            > > From: coolrobd [mailto:coolrobd@y...]
            > > Sent: Tuesday, 20 July, 2004 07:22
            > > To: perlguitest@yahoogroups.com
            > > Subject: [perlguitest] Re: Quake Console Update Unreliable
            > >
            > >
            > > SendMessage is definately the way to go I feel, but how do you
            > pass a
            > > letter using SendMessage, any syntax would be appreciated.
            > >
            > > I know you can only send one letter at a time.
            > >
            > > Thanks in advance!
            > >
            > > Rob
            > >
            > >
            > >
            > >
            > >
            > >
            > > [Non-text portions of this message have been removed]
            >
            >
            >
            > Yahoo! Groups Sponsor
            >
            > ADVERTISEMENT
            >
            >
            <http://us.ard.yahoo.com/SIG=1293586lr/M=295196.4901138.6071305.30011
            76/D=gr
            >
            oups/S=1705006951:HM/EXP=1090488476/A=2128215/R=0/SIG=10se96mf6/*http
            ://comp
            > anion.yahoo.com> click here
            >
            > <http://us.adserver.yahoo.com/l?
            M=295196.4901138.6071305.3001176/D=groups/S=
            > :HM/A=2128215/rand=781724395>
            >
            >
            > _____
            >
            > Yahoo! Groups Links
            >
            >
            > * To visit your group on the web, go to:
            > http://groups.yahoo.com/group/perlguitest/
            > <http://groups.yahoo.com/group/perlguitest/>
            >
            >
            > * To unsubscribe from this group, send an email to:
            > perlguitest-unsubscribe@yahoogroups.com
            > <mailto:perlguitest-unsubscribe@yahoogroups.com?
            subject=Unsubscribe>
            >
            >
            > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            Service
            > <http://docs.yahoo.com/info/terms/> .
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.