[Poll][TuT] Anyone wants to make an autotyper in C#???

Discussion in 'Programming General' started by Spikey69, Feb 26, 2007.

?

How did you like this tutorial?

  1. 1/5 Get out of here!

    0 vote(s)
    0.0%
  2. 2/5 Euhm, looks good, but say what?!?!?

    1 vote(s)
    12.5%
  3. 3/5 Cool, it works, and that's about all!

    1 vote(s)
    12.5%
  4. 4/5 Nice I just created my first stand-alone autotalker!!!

    0 vote(s)
    0.0%
  5. 5/5 Sweet, keep the good work coming!!!

    6 vote(s)
    75.0%
[Poll][TuT] Anyone wants to make an autotyper in C#???
  1. Unread #1 - Feb 26, 2007 at 9:18 PM
  2. Spikey69
    Referrals:
    0

    Spikey69 Guest

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    Please note, no part of this code, or the code completely, can be used or distributed without giving me credit for it... Respect my and everyone else's intellectual property!
    Hey guys!
    Just learning C# myself, so feel free to add to or comment on this idea...
    I found it hard to find a good autotalker, I'm always soooo afraid that it might contain a trojan or whatever, and if you are too, this guide should be really helpfull to writing your own, first autotalker!!!

    To start off, make sure you have the .NET FRAMEWORK running and the programming enviroment installed before following this guide...

    Then, start a new project, call it whatever you like... You will now see a completely grey form... Press F5... Great, your program is running... Too bad it doesn't do anything yet!! :cool:
    Close your program, and let's work on that layout...
    Resize the form so that it looks about 1 thumbwidth high, and very wide (a very long square program)(it's cool to be square in cyberland!).
    Try to find something called your Toolbox. In here you'll find loads of usefull Objects. Locate the object called Textbox and drag it on your form.
    Now, with that textbox selected, find something called the properties... Here we can change our textbox' attributes... Change (name) to txtTalk. Change Text to nothing.
    From your toolbox, add a button to your form... Click on it to select it and in your properties window, change name to btnTalk and Text to Talk!
    Last, before we get the code, drag a timer on your form... It will jump straight to the bottom, even below your form... Don't worry, that's ment to happen... Select it, and change it's (name) to tmrTalk.
    Press F5 again to launch your program... Woot, now it doesn't only look like crap, it doesn't do anything either!!! You might wanna get a bit more experience before sending this on your CV to Jagex... :cool:
    Close that program and double-click on your button, called btnTalk.
    What you should now be seeing is the code behind your program, something like:
    Code:
     private void btnTalk_Click(object sender, EventArgs e)
            {
    
            }
    
    It's really easy to explain really, when you'll click on your button once your program is working, the code between the two brackets, "{" and "}" will be excecuted...
    First, we want the program to switch to Runescape... Then we want it to type letters and finally, we want it to send ENTER... Easy peasy... Ajust your code to this:
    Code:
    private void btnTalk_Click(object sender, EventArgs e)
            {
                tmrTalk.Interval = 1000;
                SendKeys.Send("%{TAB}");
                tmrTalk.Enabled = true;
    
           
            }
    It basically means: wind up the timer to 1 second, switch to another program, let the timer wind off...
    Launch your program by pressing F5, press to button and notice that it will swich to the latest program you used (probably not runescape at this point) and then... doesn't do anything...
    Right, close your program and in the designer, double click on the timer called tmrTalk.
    Now, you'll see this:
    Code:
    private void btnTalk_Click(object sender, EventArgs e)
            {
                tmrTalk.Interval = 1000;
                SendKeys.Send("%{TAB}");
                tmrTalk.Enabled = true;
    
           
            }
    
            private void tmrTalk_Tick(object sender, EventArgs e)
            {
    
            }
    First of all, above the line "private void tmrTalk_tick(bla bla bla)", write:
    Code:
    int counter = 0;
    We'll need this counter later on...

    Between the brackets at the end (below tmrTalk_tick(bla bla bla)), ajust your code to:
    Code:
    Random rnd = new Random();
                tmrTalk.Enabled = false;
                tmrTalk.Interval = rnd.Next(150, 250);
                if (counter < txtTalk.Text.Length)
                {
                    SendKeys.Send(txtTalk.Text.Substring(counter, 1));
                    counter++;
                    tmrTalk.Enabled = true;
                }
                else {
                    counter = 0;
                    SendKeys.Send("{Enter}");
                
                }
    
    It basically means: stop the timer, wind it up to whatever between 150 and 250 milliseconds, send the first letter (because the variable counter is 0) and add 1 to the counter, now wind off the timer...
    Whatever random number of milliseconds later, the timer will go off again, saying, stop the timer, wind it up to whatever again, send the second letter , ... let's go again...
    After a while it will have sent all the letters and then it will reset our variable called counter, and send enter...
    Now before we test our program, make sure your code looks like this, however don't skip this entire tutorial and just copy paste, it won't work if you do!!!
    Code:
    private void btnTalk_Click(object sender, EventArgs e)
            {
                tmrTalk.Interval = 1000;
                SendKeys.Send("%{TAB}");
                tmrTalk.Enabled = true;
    
           
            }
            int counter = 0;
            private void tmrTalk_Tick(object sender, EventArgs e)
            {
                Random rnd = new Random();
                tmrTalk.Enabled = false;
                tmrTalk.Interval = rnd.Next(150, 250);
                if (counter < txtTalk.Text.Length)
                {
                    SendKeys.Send(txtTalk.Text.Substring(counter, 1));
                    counter++;
                    tmrTalk.Enabled = true;
                }
                else {
                    counter = 0;
                    SendKeys.Send("{Enter}");
                
                }
    
            }
    Now press F5 to launch your program, and if you don't get any errors, congratulations, you just made your first autotalker!!!
    Woot!
    Close your program, close visual C#. It will ask you if you want to save your project, select yes!
    Give it whatever name you would like, and save it ON YOUR DESKTOP (so we can locate it easely!!)
    Now on your desktop you'll see a folder, open it, click on your programs name again, click on the folder bin, then click on the folder called debug, and there it is, YOUR AUTOTALKER!!!

    Launch it, launch runescape, log in, type some text in your program, click the button and watch it talk!!!

    :eek: W00T!!!:eek:

    That was easy wasn't it??
    I'd upload my program for everyone to use but I'm not sure I'm allowed on this forum...
    Now if someone would follow this guide and post screenshots, as well as all comments and feedback, It'd be much appreciated!!!

    :cool: Enjoy and have a nice day!!:cool:
     
  3. Unread #2 - Feb 26, 2007 at 9:23 PM
  4. Spikey69
    Referrals:
    0

    Spikey69 Guest

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    Too bad it's soo late at the moment, but I'll be posting more code to make this program even better, and tutorials to make other nice cheating programs in the future, IF the poll indicates that all of you liked it enough... :)
     
  5. Unread #3 - Feb 26, 2007 at 9:28 PM
  6. Spikey69
    Referrals:
    0

    Spikey69 Guest

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    And yes, I did vote 5/5 on my own poll, couldn't resist lol!!!!
     
  7. Unread #4 - Feb 27, 2007 at 3:07 AM
  8. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    Umm, this is just like VB, everyone's code for this sort of thing will look the same, so you can't say to give credit.
     
  9. Unread #5 - Feb 27, 2007 at 10:21 AM
  10. Spikey69
    Referrals:
    0

    Spikey69 Guest

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    Ok, but you're not seeing the whole picture here... I'm planning on writing tuts for waaaay bigger programs... But nvm, let's not get off track about the first sentence here... :) This guide was intended for people that almost never used C# before lol... :)

     
  11. Unread #6 - Mar 14, 2007 at 2:43 AM
  12. SidStudios
    Joined:
    Mar 14, 2007
    Posts:
    201
    Referrals:
    0
    Sythe Gold:
    0

    SidStudios Active Member

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    It doesn't come close to VB.

    This is much harder to program unless you use Microsoft C# Express edition.

    And, there is a much better way to capture errors in C# with the
    try{
    //code here
    }
    catch (Exception){
    }
     
  13. Unread #7 - Feb 27, 2008 at 5:42 PM
  14. man ace555
    Referrals:
    0

    man ace555 Guest

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    This is my first try at using any script programs and yours was the one that was the most simple, and easy to follow so i tried yours.

    I just tried making the auto typer and everything apart from the end was working. Do u have any ideas on how to fix it?
    Follow the link to see the problem.

    http://www.bebo.com/PhotoAlbumBig.jsp?MemberId=1720906851&PhotoAlbumId=1795954432&PhotoId=7015569208[/URL]

    plz help
    lol
    :D
    thx
     
  15. Unread #8 - Feb 27, 2008 at 6:45 PM
  16. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    C# is not C++ or C.

    C# is Microsoft's aborted attempt at controlling portable code and wrestling market share away from Java (OK -- I'm bitter because Mono is shit).
     
  17. Unread #9 - Feb 27, 2008 at 7:13 PM
  18. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    Use VMWare @ Darby.
     
  19. Unread #10 - Feb 27, 2008 at 7:21 PM
  20. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    But I like my current operating system >: Why would I buy winders?
     
  21. Unread #11 - Feb 29, 2008 at 10:29 PM
  22. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    [Poll][TuT] Anyone wants to make an autotyper in C#???

    You just said practically, the .Net framework isn't equal to the .Net framework.

    You do the same thing with a different syntax, thus making it like VB.Net. I should have really said dotnet in my first post.

    Ya Darby, C# is a rip of Java, but I prefer to use the .Net framework with C# over the .Net framework with VB. Java is good, but I'm much more use to the .Net libraries and classes. The only thing I don't like is Microsoft isn't being nice to the Linux users. When you register a product, there is a checkbox sequence asking what you are interested in. I next to always have "Linux and Windows interoperability". Nothing is happening.

    I'd be much happier with MS if they ported some of their more innovative products (the .Net framework, for example) to Linux.
     
< English To 1377 Translator .....HEHE | [SOURCE] Basic C++ Hangman in the Command Prompt >

Users viewing this thread
1 guest


 
 
Adblock breaks this site