Home > Archive > Visual Basic > March 2006 > Automatize two keys-stokes?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Automatize two keys-stokes?
|
|
|
| My son is asking if it is possible to program a program that pushes two
keys alternatively with 1 second delay when he is playing a game but has
to go and do other stuff? For example when he has to go and eat then he
wants the q-key be pushed and after 1 second the e-key and after 1
second the q-key and after 1 second the e-key and so on so the game he
is playing proceeds. How do I do that?
| |
|
| Add a timer to form1, and set interval to 1000
Then add this code to the form, run it and open notepad.
Option Explicit
Dim iqKey As Long
Private Sub Timer1_Timer()
If iqKey = 0 Then
iqKey = 1
DoEvents
SendKeys "{q}"
DoEvents
Else
iqKey = 0
DoEvents
SendKeys "{e}"
DoEvents
End If
End Sub
"RE" <rolfe@algonet.se> wrote in message
news:uxzfkzmUGHA.1564@TK2MSFTNGP11.phx.gbl...
> My son is asking if it is possible to program a program that pushes two
> keys alternatively with 1 second delay when he is playing a game but has
> to go and do other stuff? For example when he has to go and eat then he
> wants the q-key be pushed and after 1 second the e-key and after 1
> second the q-key and after 1 second the e-key and so on so the game he
> is playing proceeds. How do I do that?
>
>
>
>
>
| |
|
| TedF,
I and my son are VERY grateful!!!!
Thank you!!!
Rolf and David
"TedF" <NoReply@xxxmsn.com> skrev i meddelandet
news:%23d$rlVuUGHA.5808@TK2MSFTNGP12.phx.gbl...
> Add a timer to form1, and set interval to 1000
> Then add this code to the form, run it and open notepad.
>
> Option Explicit
> Dim iqKey As Long
> Private Sub Timer1_Timer()
> If iqKey = 0 Then
> iqKey = 1
> DoEvents
> SendKeys "{q}"
> DoEvents
> Else
> iqKey = 0
> DoEvents
> SendKeys "{e}"
> DoEvents
> End If
>
> End Sub
>
>
>
> "RE" <rolfe@algonet.se> wrote in message
> news:uxzfkzmUGHA.1564@TK2MSFTNGP11.phx.gbl...
>
>
|
|
|
|
|