wc3edit.net

United Warcraft 3 map hacking!
It is currently March 29th, 2024, 5:58 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: December 2nd, 2009, 3:06 am 
Offline
Noob
User avatar

Joined: December 23rd, 2008, 11:27 pm
Posts: 1183
Location: Your Girlfriend's Pants.
Title: LSD.
Today I will teach you how to make a simple autotyper in C#.
Start off by starting a new project and naming it whatever you want.


Add some controls to the form:
- Button
- Textbox
- Timer

It really doesn't mater how you organize them, just make sure to make it look nice.

I've explained the functions in the code, so if you need references you know what they mean.

Double click on your button and enter the following code below into the button1_Click event

Code:
//button1_Click

//Sets the timer's interval. Pretty straight forward.
timer1.Interval = 1000;

//Tells the computer to switch to the last window open.
SendKeys.Send("%{TAB}");

//Enable the timer and therefore starts the typing.
timer1.Enabled = true;


Now, anywhere between the public partial class Form1: Form tags, add this
Code:
int count = 0;


Example:
Code:
public partial class Form1 : Form
{
int count = 0;
}


Now, double click the timer to bring up it's tick event.
Code:
//timer1_Tick


//Generates a random number. Important so it's undetectable.
Random randomnum = new Random();

//Temporarily disables the timer.
timer1.Enabled = false;

//Sets the timer's interval to a random number between 125 and 225.
timer1.Interval = randomnum.Next(125, 225);

//Checks if the length of the textbox text is greater than zero.
if (count < textBox1.Text.Length)
{

//Starts typing the textbox's text. Uses the counter to make sure there is text to type.
SendKeys.Send(textBox1.Text.Substring(count, 1));

//Increases the count by 1.
count++;

//Re-enables the timer.
timer1.Enabled = true;

}
//If there is nothing left to type.
else
{
count = 0;

//Hits the enter key.
SendKeys.Send("{Enter}");

}


Hit F5, type something in the text box, open up notepad, then click start.
If your autotyper is working, congratulations!

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)