|
-
Oct 21st, 2011, 04:22 PM
#1
Thread Starter
New Member
Simple program. Need help.
I want to make a simple program that will click certain keys on my keyboard at a certain interval. I have VB10. Could someone provide me with some code?
-
Oct 21st, 2011, 04:45 PM
#2
Addicted Member
Re: Simple program. Need help.
What Keys, what interval, any code inside the keys?
-
Oct 21st, 2011, 04:59 PM
#3
Addicted Member
Re: Simple program. Need help.
Okay i figured it out, which was fun, working out the errors(having the letter f wrote infinitely )
You will need a timer1 and then just this code.
Code:
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Interval = 10000 '10 seconds
My.Computer.Keyboard.SendKeys("f", True)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
End Class
-
Oct 21st, 2011, 05:01 PM
#4
Addicted Member
Re: Simple program. Need help.
IF you want it to write to any specific file use this
Code:
Dim ProcID As Integer
' Start the Calculator application, and store the process id.
ProcID = Shell("CALC.EXE", AppWinStyle.NormalFocus)
' Activate the Calculator application.
AppActivate(ProcID)
' Send the keystrokes to the Calculator application.
found this at http://msdn.microsoft.com/en-us/library/ms127847.aspx
-
Oct 21st, 2011, 05:01 PM
#5
Re: Simple program. Need help.
Use a timer and send a different key on each click. That would be the way to get the interval in there. Look up SendKeys for the key presses....maybe. Actually, after reading what Joshlad suggested, it does occur to me that there could be multiple ways to read that question. I was thinking that your goal was to send keys presses to some other program, but that isn't necessarily the case. Perhaps a bit more description would be good.
EDIT: Wow, I think I need to refresh my browser faster. You had it solved before I even started writing.
My usual boring signature: Nothing
 
-
Oct 21st, 2011, 08:08 PM
#6
Thread Starter
New Member
Re: Simple program. Need help.
I just want the program to hit the keys 6 and 7 every 5 seconds. Thanks for all the assistance!
-
Oct 22nd, 2011, 05:54 AM
#7
Addicted Member
Re: Simple program. Need help.
Code:
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Interval = 5000 '5 seconds
My.Computer.Keyboard.SendKeys("6", True)
My.Computer.Keyboard.SendKeys("7", True)
End Sub
sub button_click 'you finish it
Timer1.Enabled = True
End Sub
End Class
use a button also to enable the timer, and begin keys
 Originally Posted by Shaggy Hiker
EDIT: Wow, I think I need to refresh my browser faster. You had it solved before I even started writing.
May not be able to provide code, but i sure can provide the logic
AutoTyper Moves Mouse Cursor to Screen Position
All my Projects contain flashy scrolling text 
-
Oct 22nd, 2011, 10:48 AM
#8
Thread Starter
New Member
Re: Simple program. Need help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|