Sunday, November 7, 2010

C# Tutorial: Create a Simple AutoTyper/Spammer

Here is the code

using System.Threading;
////////////////////////////////////////////////
char[] keys; int i;
private void button1_Click(object sender, EventArgs e)
{
    keys = textBox1.Text.ToCharArray(); i = 0;
    // Pause the program so you have time to focus your program (Ex: Notepad)
    Thread.Sleep(800);
    timer1.Start(); 
}
        
private void timer1_Tick(object sender, EventArgs e)
{
    if ((int)keys[i] == 13)
        SendKeys.Send("{BACKSPACE}");
    else SendKeys.Send(keys[i].ToString()); i++;
    if (i >= keys.Length) timer1.Stop(); 
}

private void button2_Click(object sender, EventArgs e)
{
    timer1.Stop(); 
}

Or download the solution

No comments:

Post a Comment