First of all, sorry for my bad english, that doesn't make any sence at all. So, please correct me.
I made a programm to use SendKeys, but I want a delay between the word.
I was able to split the string in words, but I wasn't be able to send it with a delay.
My program pasts the text of the clipboard (using RadioTextbox) and from the textbox (using the radiobutton RadioClipboard and textbox TextBox1). Button1 starts the whole thing. I have a timer, which counts down to zero.
This snippet splits the string:
string[] text = TextBox1.Text.Split(' ');
foreach (string sendword in text)
{
//Sendkeys.Send(word); and some sort of delay or something
//Or a delay which sends the string word
}
This is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Windows.Forms.VisualStyles;
using System.IO;
using System.Text.RegularExpressions;
using System.Drawing.Drawing2D;
namespace Tio_Copy_Paster
{
public partial class Form1 : Form
{
int timer1value = 5;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
RadioTextbox.Enabled = false;
RadioClipboard.Enabled = false;
TextBox1.ReadOnly = true;
Button1.Enabled = false;
Button1.Text = "5";
}
private void timer1_Tick(object sender, EventArgs e)
{
if (timer1value == 0)
{
if (RadioTextbox.Checked == true)
{
Sendkeys.Send(TextBox1.Text); //Sends the whole string
//Should split the string and delay it.
//Maybe using a timer, it might send the string
}
else if (RadioClipboard.Checked == true)
{
SendKeys.Send(Clipboard.GetText());
//The same here
}
timer1.Enabled = false;
RadioClipboard.Enabled = true;
RadioTextbox.Enabled = true;
Button1.Text = "Plak!";
Button1.Enabled = true;
timer1value = 5;
TextBox1.ReadOnly = false;
}
else
{
timer1value = timer1value - 1;
Button1.Text = timer1value.ToString();
}
}
}
}