Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 118,880 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,977 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



help with project code please

 
Reply to this topicStart new topic

help with project code please

itso2005
post 1 Jul, 2008 - 11:55 AM
Post #1


New D.I.C Head

*
Joined: 30 Jun, 2008
Posts: 3

CODE

Do
       SendKeys.Send("{1}")
       SendKeys.Send("{2}")
       SendKeys.Send("{3}")
       Exit Do
Loop


Hi this is a project i am making and these statements im trying to make them send the keys 1,2,3 but also i would like for it to wait a certain time between statements. Ex: once it presses key 1 i would like it to wait 4 secs and then press the number 2 key and then wait 4 more secs and press number 3 key.

And I am sorry I would also like these statements to loop until I press a certain combination of keys for ex: Alt +N. So it would pretty much stop the application from executing.
Can some1 pls help me thank you!!!
User is offlineProfile CardPM

Go to the top of the page


jacobjordan
post 1 Jul, 2008 - 12:14 PM
Post #2


class Me : Perfection

Group Icon
Joined: 11 Jun, 2008
Posts: 884



Thanked 19 times

Dream Kudos: 1500
My Contributions


First of all, why are you putting braces around the numbers? Also, to do what you want, you need to add a timer to your form. If you want it to run through every 4 seconds, like you said, you need to set it's interval to 4000 (because the interval is measured in 1/1000 secs). Then, put this code

vb

Dim key As Integer
Private Sub Timer1_Timer()
key = key + 1
SendKeys (CStr(key))
If key = 3 Then
key = 0
Timer1.Enabled = False
End If
End Sub

That will send the keys 1, 2, and then 3, with a delay of 4 seconds between each.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 02:48AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month