Start off by starting a new project and naming it whatever you want.
Add some controls to the form:
- Button
- Textbox
- Timer
It really doesn't mater how you organize them, just make sure to make it look nice.
I've explained the functions in the code, so if you need references you know what they mean.
Double click on your button and enter the following code below into the button1_Click event
Code: Select all
//button1_Click
//Sets the timer's interval. Pretty straight forward.
timer1.Interval = 1000;
//Tells the computer to switch to the last window open.
SendKeys.Send("%{TAB}");
//Enable the timer and therefore starts the typing.
timer1.Enabled = true;
Code: Select all
int count = 0;
Code: Select all
public partial class Form1 : Form
{
int count = 0;
}
Code: Select all
//timer1_Tick
//Generates a random number. Important so it's undetectable.
Random randomnum = new Random();
//Temporarily disables the timer.
timer1.Enabled = false;
//Sets the timer's interval to a random number between 125 and 225.
timer1.Interval = randomnum.Next(125, 225);
//Checks if the length of the textbox text is greater than zero.
if (count < textBox1.Text.Length)
{
//Starts typing the textbox's text. Uses the counter to make sure there is text to type.
SendKeys.Send(textBox1.Text.Substring(count, 1));
//Increases the count by 1.
count++;
//Re-enables the timer.
timer1.Enabled = true;
}
//If there is nothing left to type.
else
{
count = 0;
//Hits the enter key.
SendKeys.Send("{Enter}");
}
If your autotyper is working, congratulations!