• Log in or sign up for an account here: https://www.sythe.org/login

auto typer

flickflackflick

Active Member
Joined
Jul 18, 2010
Sythe Gold
0
Messages
109
could anyone show me how to make an autotyper, i think it would go in this section :o
 
In order to simulate key events you would call the keyPress() and keyRelease() methods of the java.awt.Robot class after obtaining an instance of the class. The int argument that you pass to the method is the VK key code of the key to press/release. The VK keycodes are kept as constants in the java.awt.event.KeyEvent class. An extremely example of this can be found here.
 
Heres a basic autotyper, but I made it not allow any symbols due to them causing it errors
Code:
import java.awt.AWTException;
import java.awt.GridLayout;
import java.awt.Robot;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class Main extends JFrame implements ActionListener,Runnable{
    JTextField one,two;
    char[] arr;
    public Main(){
        one = new JTextField(20);
        two = new JTextField(20);
        setSize(250,150);
        setLayout(new GridLayout(5,5));
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("Autotyper");
       setResizable(false);
        add(one);
       two.setEditable(false);
        add(two);
        JButton b = new JButton("Go!");
        add(b);
        b.addActionListener(this);
    }
    public Main(char[] ar){
      //  this();
        arr = ar;
    }
    public static void main(String[] args){
        try{
            
            new Main().setVisible(true);
        }catch(Exception e){e.printStackTrace();}
    }
    private void copy(Robot robot, char[] charsToPrint){
        robot.setAutoDelay(100);
        for(char l : charsToPrint)
        {
            if(Character.isUpperCase(l)){
                robot.keyPress(16);
                pNr(robot,(int)l);
                robot.keyRelease(16);
            }
            else if (Character.isLetterOrDigit(l))pNr(robot, Character.toUpperCase(l));
            else if(Character.isWhitespace(l))pNr(robot,KeyEvent.VK_SPACE);
        }
       edit(true);
       one.requestFocus();
       one.setText(null);
    }
    private void pNr(Robot robot, int to)
    {

        robot.keyPress(to);
        robot.keyRelease(to);
    }
    public void run(){
        try{
            copy(new Robot(),arr);
        }catch(AWTException e){System.err.println(e);};
    }
    private void edit(boolean edit){
        one.setEditable(edit);
        two.setEditable(!edit);
    }
    public void actionPerformed(ActionEvent e){
        if(one.getText().length() < 1)
            return;
        edit(false);
        two.setText(null);     
        two.requestFocus();
        arr = one.getText().toCharArray();
        try{
            new Thread(this).start();
        }catch(Exception ae){ae.printStackTrace();}

    }
}
 
ok, wow thanks, now i see it, i couldnt of done this

thanks alot though, and what do i put that in?
 
hm...idk what u mean by that im extremely new to coding and havent ever tried java before
 
your best bet is to use that one as a guide, and start from scratch, otherwise you'll never understand it.. check out Netbeans, the gui editor is nice for beginers
 
Runescape Gamblingrunescape gambling
Back
Top