automatic typing with VB - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

automatic typing with VB

SentientPhilSentientPhil Posts: 1Member
Hi guys, i have started my life in the world of programming.. im 27, so probably 15 years too late :s

i wrote my first easiest ever program yesterday, which basicaly teaches me how to create a UI with 2 buttons and a text box... i type what ever i like in the text box, click button1 and it repeatedly types that text into the active window until i click button2 (stop)

i.e.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Timer1.Start()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
End Class


so i learned the timer, and what "SendKeys.Send" is all about... and how to assign a basic function to a button etc etc...

now, what i thought after that, wouldnt it be cool to add another few textbox's so it would repeat 3-4-5 lines of text like an address, then keep on repeating it to create like postal labels to print off... which is what i was wondering if someone could help with... i.e. have:

SendKeys.Send(TextBox1.Text)
Sendkeys.Send("{Enter}")
PAUSE FOR 250ms
SendKeys.Send(TexyBox2.Text)
SendKeys.Send("{Enter}")
PAUSE FOR 250ms

etc etc etc

SendKeys.Send(TextBox6.Text)
SendKeys.Send("{Enter}")
PAUSE FOR 250ms
LOOP TO BEGINNING
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")

etc etc etc

i understand this could be used to annoy the hell out ot people.. and thats not my intention.. i am an ethical programmer.. and never did programming sooner because i always associated it with "scriptkiddy" types and blackhat.. but after recently looking into it, it never occured to me that it can be used for the greater good without proving yourself first if that makes sense.. i know this program has no real purpose apart from showing off to my family, i have actually made SOMETHING that does SOMETHING lol.. i learn by doing, and this tutorial i found was a video, so i could play along nicely.. reading books of text just annoys me.. im a doer, not a reader lol...

many thanks for the help... would be much appreciated...
Sign In or Register to comment.