Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

need help with auto typer in visual basic 10

ok im building for a friend a very simple basic auto typer with 1 text box 2 buttons and 1 timer...what i need to know is what would be the code i would put in if i added a second text box and wanted to make that how many times the auto typer cycled before stopping..so far this is what i have.


Public Class Form1

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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub

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

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

End Sub
End Class


what code would i add to textbox2 to make the program so that it cycles text then stops after however many cycles i specify in textbox2???
Add this to the timer. My code is a bit sloppy but it will work.

Code
Textbox2.text = Textbox2.text - 1 ' <--- Subtract's 1 from the textbox before performing the rest of the function
SendKeys.Send(TextBox1.Text) 'You should know what this does
SendKeys.Send("{Enter}")
If Textbox2.Text <= 0 Then 'Returns a true if Textbox2.Text is less than or equal to Zero.
Timer1.Stop 'If its true, the timer stops. If false, the program jumps back to the top of the code.
End If 'End's the if.
or make a label and do this for the timer
Code
Label1.text +=1
if label1.text="PUT THE NUMBER HERE" then
timer1.stop
else
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{ENTER}")
(Feb 4, 2012 06:24 PM)eXBTLegends Wrote:  or make a label and do this for the timer
Code
Label1.text +=1
if label1.text="PUT THE NUMBER HERE" then
timer1.stop
else
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{ENTER}")

I think he wants it so its user input, instead of him forcing it. I would probably also recommend that his start button makes the textboxes readonly to prevent errors, but thats just me.
Add a numeric up and down and use this code, the numeric up down will be how many times it runs
Code
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i As Integer = 0
If i = numericupdown1.value then
timer1.stop
end if
SendKeys.Send(TextBox1.Text)
SendKeys.Send("{Enter}")
i = i + 1
End Sub

Forgot to add the increment, added it
Something like that
I hate it when people use timers... L2Thread.... :\

Anyways, Use keycodes.
(Feb 4, 2012 06:32 PM)Cherish Life Wrote:  I hate it when people use timers... L2Thread.... :\

Anyways, Use keycodes.

would you give me an example of using keycodes im a noob but you cant knock me for trying to learn better methods
Hi I am an Absolute NOOB.
I need an auto typer to typer a page of formatted text about 50-60 lines created in notepad, into
a ruler notepad, or some other editors that don not allow paste function.

Please can anyone help. Thanks
(Dec 6, 2016 12:33 AM)222bart Wrote:  Hi I am an Absolute NOOB.
I need an auto typer to typer a page of formatted text about 50-60 lines created in notepad, into
a ruler notepad, or some other editors that don not allow paste function.

Please can anyone help. Thanks

You want a shovel ? stop grave digging.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Source] by SIM-5420967May 26, 2024 09:50 AM 2 372 May 26, 2024 09:50 AM
Last Post: xiaowanga8
[.NET] by BladabindiMay 17, 2023 12:20 AM 1 178 May 17, 2023 12:20 AM
Last Post: NyQuil
[.NET] by DrpriyaOct 4, 2022 11:17 PM 4 332 Oct 4, 2022 11:17 PM
Last Post: LeetSpeed