Well, this is a auto talker I made.
You will need
2 buttons, start and stop.
And a textbox.
And a Timer.
Here is the code -
Under
Code:
public partial class Form1 : Form
{
Declare
It is then like
Code:
public partial class Form1 : Form
{
int count = 0;
Under
Code:
public Form1()
{
InitializeComponent();
}
Add this
Code:
public void stopProcess(String File)
{
System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcesses();
for (int i = 0; i <= process.GetUpperBound(0); i++)
{
if (process[i].ProcessName == File)
{
process[i].Kill();
}
}
}
We use that method later on for stopping the talker.
Here is your methods for button1
Code:
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = 1000;
SendKeys.Send("%{TAB}");
timer1.Enabled = true;
}
Timer methods
Code:
private void timer1_Tick(object sender, EventArgs e)
{
Random randomnum = new Random();
timer1.Enabled = false;
timer1.Interval = randomnum.Next(125, 225);
if (count < textBox1.Text.Length)
{
SendKeys.Send(textBox1.Text);
SendKeys.Send("{Enter}");
timer1.Enabled = true;
}
else
{
count = 0;
SendKeys.Send("{Enter}");
}
}
For button2, your stop button, your process is what you named it, mine was talker so I end the process talker.
Code:
private void button2_Click(object sender, EventArgs e)
{
stopProcess("Talker");
timer1.Enabled = false;
}
I haven't added a frequency to it, but if you wanted, the code would be something like -
Code:
timer1.Interval = Convert.ToInt32(textBox2.Text);
Note - I don't take all credits for this.