Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:10:46+00:00 2026-05-28T03:10:46+00:00

I am having a app which use one loop to type the text in

  • 0

I am having a app which use one loop to type the text in the time intervals. Now, I want the text to be typed with small spaces between each character.

I have tried this code but when I start the timers the typing keeps continuing inside of second timer. There is no spaces in my first times which timed my lines.

private List<char> charList = new List<char>();

public AutoTyper()
{
    InitializeComponent();

    tmrInterval.Tick += new EventHandler(Interval);
    tmrDelay.Tick += new EventHandler(Delay);
    tmrSpace.Tick +=new EventHandler(charSpaces);
    txtText.TextChanged += new EventHandler(TextChanged);
    tbType.SelectedIndexChanged += new EventHandler(IndexChanged);
}

private void Interval(object sender, EventArgs e)
{
    if (cbPause.Checked == false)
    {
        SendKeys.Send(txtText.Text + "{enter}");

        if (tbType.SelectedTab == tbInterval)
        {
            tmrInterval.Interval = int.Parse(nudInterval.Value.ToString());
        }

        if (tbType.SelectedTab == tbRange)
        {
            tmrInterval.Interval = random.Next(int.Parse(nudMin.Value.ToString()), int.Parse(nudMax.Value.ToString()));
        }
    }
    else if (cbPause.Checked == true)
    {
        tmrSpace.Enabled = true;
    }
}

private void charSpaces(object sender, EventArgs e)
{
    Random random = new Random();
    tmrSpace.Interval = random.Next(200, 400);

    foreach (char character in charList)
        SendKeys.Send(character.ToString());
    SendKeys.Send("{enter}");
}

Edit, I have tried to use thread sleep version so I have deleted the times. All I have now is following but it halts my PC.

private void Interval(object sender, EventArgs e)
{
    if (cbPause.Checked == false)
    {
        SendKeys.Send(txtText.Text + "{enter}");

        if (tbType.SelectedTab == tbInterval)
        {
            tmrInterval.Interval = int.Parse(nudInterval.Value.ToString());
        }

        if (tbType.SelectedTab == tbRange)
        {
            tmrInterval.Interval = random.Next(
                int.Parse(nudMin.Value.ToString()), 
                int.Parse(nudMax.Value.ToString()));
        }
    }
    else if (cbPause.Checked == true)
    {
        Random random = new Random();

        foreach (char character in charList)
        {
            SendKeys.Send(character.ToString());
            Thread.Sleep(random.Next(400, 500));
        }

        SendKeys.Send("{enter}");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:10:47+00:00Added an answer on May 28, 2026 at 3:10 am

    Using timer is much better option than pausing thread. This is how I have done it:

        private void Space(object sender, EventArgs e)
        {
            SendKeys.Send(txtText.Text.Substring(b++, 1));
    
            tmrSpace.Interval = random.Next(50, 150);
    
            if (b == txtText.TextLength)
            {
                tmrSpace.Enabled = false;
                SendKeys.Send("{enter}");
            }
        }
    
        private void Interval(object sender, EventArgs e)
        {
            if (cbPause.Checked)
            {
                b = 0;
    
                tmrSpace.Interval = random.Next(50, 150);
                tmrSpace.Enabled = true;
            }
            else
            {
                SendKeys.Send(txtText.Text + "{enter}");
    
                if (tbType.SelectedTab == tbRange) tmrInterval.Interval = random.Next(int.Parse(nudMin.Value.ToString()), int.Parse(nudMax.Value.ToString()));
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a small web app, which plays really short sound bits on the
I'm having a problem at work in that our app which uses WCF for
I am creating an app that is having a UIWebView which contains an advert.
I've seen projects which use many screens each one for different layout and functionality.
We are having performance issues on our web app during peak times, which is
I want to make an app which (amongst other things) can parse feeds loaded
I am building one app having one list view showing list of users this
We wanted to use a UITabBar in our iPhone app, but with one exception:
I am developing a Catalyst app which uses Template::Toolkit as template engine. One page
I got a little ruby app going and I'm having trouble with one part.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.