Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

AutoTyper(Spammer) In C#

timer

  • Please log in to reply
9 replies to this topic

#1 Kierien

Kierien

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 31 January 2009 - 10:45 AM

Hey,

This tut is extremely simple, a good one for C# beginners =)

First create a new C# project by going to

File>New>C#>Windows Forms Application

Then add 1 timer, 3 textboxes, and 2 buttons.

First were gonna give your timer a code, double click on your timer and add this code

SendKeys.Send(textBox1.text);
SendKeys.Send("{ENTER}");
SendKeys.Send(textBox2.text);
SendKeys.Send("{ENTER}");
SendKeys.Send(textBox3.text);
SendKeys.Send("{ENTER}");

The SendKeys Function basically types out the text you specify.

Now rename one of your buttons to "Start", and give it the following code

timer1.Enabled = true;

This enabled the timer, which in return, starts spamming your text.

Then rename another one to "Stop", and give it the code below

timer1.Enabled = false;

This disables your times, which stops the spamming.

And ur done =D

How simple was that? :rolleyes:

Hope you learned a thing or two from this.

~kierien

Edited by Kierien, 31 January 2009 - 09:02 PM.

  • 0

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 31 January 2009 - 02:16 PM

Not bad, perhaps a bit more explanation though? Newbs are not going to know what a timer does or what the SendKeys class is. Perhaps you should give more detail on these two things. Also, don't you need a timer_tick function before your timer1 will do anything?
  • 0

#3 Kierien

Kierien

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 31 January 2009 - 09:00 PM

Not bad, perhaps a bit more explanation though? Newbs are not going to know what a timer does or what the SendKeys class is. Perhaps you should give more detail on these two things. Also, don't you need a timer_tick function before your timer1 will do anything?


Alright, will reedit to more detail, and no we dont need a timer_tick, because we already have our timer enabled and disabled via buttons.

~kierien
  • 0

#4 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 01 February 2009 - 04:44 AM

You have misunderstood. Timer_Tick is the subroutine that runs whenever the timer ticks.

All of this code:

SendKeys.Send(textBox1.text);
SendKeys.Send("{ENTER}");
SendKeys.Send(textBox2.text);
SendKeys.Send("{ENTER}");
SendKeys.Send(textBox3.text);
SendKeys.Send("{ENTER}");

..is put within the timer_tick subroutine.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#5 wajouba

wajouba

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 01 July 2009 - 04:25 AM

ok, I'm very new, so should I attempt this or not, cause it looks like its incomplete or lacking info...?!

:)
  • 0

#6 wajouba

wajouba

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 01 July 2009 - 05:17 AM

I tried this, and got some errors at the end of each of the SendKeys.Send(textBox1.text);

the error is:
dosn't contain definition for text and no extension method text.

Did I need a reference that I didn't use?! :S
I don't get it sorry I'm new :$
  • 0

#7 Kierien

Kierien

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 05 July 2009 - 08:34 AM

It's .Text, not .text
  • 0

#8 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 05 July 2009 - 01:17 PM

I think the IDE will correct that for you.

What does this do?

SendKeys.Send(textBox1.text);

Like Jordan said, newbs won't understand what this is doing.

Now rename one of your buttons to "Start"

Why? I don't see anywhere in your code, you referencing the button that you want me to call "Start". So why should I?

Alright, will reedit to more detail, and no we dont need a timer_tick, because we already have our timer enabled and disabled via buttons.


Yes, you do need a timer_tick method. When you double click on a timer, one is created for you.
  • 0

#9 wajouba

wajouba

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 05 July 2009 - 01:59 PM

yes its true im trying to figure out what its doing, but I guess tomorow mourning would be better... plus you are right .Text was the problem, I did it and I got stuck in the autospamer when I tried it... :)
  • 0

#10 Kierien

Kierien

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 06 July 2009 - 10:14 PM

I think the IDE will correct that for you.

What does this do?

SendKeys.Send(textBox1.text);

Like Jordan said, newbs won't understand what this is doing.

Now rename one of your buttons to "Start"

Why? I don't see anywhere in your code, you referencing the button that you want me to call "Start". So why should I?



Yes, you do need a timer_tick method. When you double click on a timer, one is created for you.


First of all, i wanted to rename the button to "Start" so that things will look neater. Secondly, yes i know when i double click on a timer a timer_tick is created for me. But i was referring to Jordan's post on whether a timer_tick was needed before the timer would function. And yeah we would need one, but it's already created anyway.
  • 0





Also tagged with one or more of these keywords: timer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download