Hey everyone. As some of you may remember, I created an AutoTalker back in the day for Cora Dyce hosts. I only sent the program to hosts, and never released the source code, as I did not want other clans utilizing it. It's by no means great, but I had an enjoyable time coding it and learning some new things. The full source code is included below.
Things to note:
#1: This code is sloppy as hell. I wrote a lot of it after 1 a.m., so if you're looking for some beautiful organizational skills, look somewhere else. It's not nearly as optimized as it could be, but for the job at hand it works fine.
#2: The algorithm to determine typing speed in the code below is NOT the actual code I used. v1.2 was coming out with an algorithm I have been working on for some time, but it is still in testing phases. The reason I didn't release it is because I will be using the better code on an AIO AutoTalker, that I'll most likely sell or release publicly. Basically, it mimics your two hands positions, and determines how quickly you could type out words based on finger positions and where the other keys are located on the board. I'll hopefully release this soon.
#3: The public/friends/clan chat can get kind of screwy. It was working, then I moved some stuff around, then it started acting up. If you guys want to fix it, be my guest.
#4: This was while I was still learning a good deal, so no hating on muh code.
#5: Post any questions you want, would be more than happy to answer them.
Things to note:
#1: This code is sloppy as hell. I wrote a lot of it after 1 a.m., so if you're looking for some beautiful organizational skills, look somewhere else. It's not nearly as optimized as it could be, but for the job at hand it works fine.
#2: The algorithm to determine typing speed in the code below is NOT the actual code I used. v1.2 was coming out with an algorithm I have been working on for some time, but it is still in testing phases. The reason I didn't release it is because I will be using the better code on an AIO AutoTalker, that I'll most likely sell or release publicly. Basically, it mimics your two hands positions, and determines how quickly you could type out words based on finger positions and where the other keys are located on the board. I'll hopefully release this soon.
#3: The public/friends/clan chat can get kind of screwy. It was working, then I moved some stuff around, then it started acting up. If you guys want to fix it, be my guest.
#4: This was while I was still learning a good deal, so no hating on muh code.
#5: Post any questions you want, would be more than happy to answer them.
- Spoiler:
package main;
import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Robot;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.JCheckBox;
@SuppressWarnings("serial")
public class MainFrame extends JFrame implements WindowListener,ActionListener {
public JPanel contentPane;
private JTextField textField;
static MainFrame frame = new MainFrame();
int test;
char next = 'v';
boolean stop = false;
boolean create = true;
int number;
JButton btn_Start = new JButton("Start!");
JButton btn_Stop = new JButton("Stop!");
String host;
String level;
String wager;
String line;
boolean publicChat;
boolean friendsChat;
boolean clanChat;
boolean doubleChat;
double versionNumber = 1.1;
int o = 0;
/**
* Launch the application.
*/
public static void main(String[] args) throws URISyntaxException {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame.setVisible(true);
frame.setAlwaysOnTop( true );
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainFrame() {
setTitle("CoraTalker - v1.1");
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 336, 259);
contentPane = new JPanel();
contentPane.setToolTipText("");
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblWagerAmount = new JLabel("Wager Amount:");
lblWagerAmount.setFont(new Font("Tahoma", Font.PLAIN, 18));
lblWagerAmount.setBounds(10, 13, 143, 22);
contentPane.add(lblWagerAmount);
textField = new JTextField();
textField.setBounds(161, 15, 159, 22);
contentPane.add(textField);
textField.setColumns(10);
JLabel lblEgkm = new JLabel("e.g. 400k, 3m");
lblEgkm.setBounds(20, 37, 97, 16);
contentPane.add(lblEgkm);
btn_Start.setBounds(161, 63, 159, 99);
contentPane.add(btn_Start);
btn_Stop.setBounds(161, 63, 159, 99);
contentPane.add(btn_Stop);
btn_Stop.setVisible(false);
final JCheckBox Friends = new JCheckBox("Friends");
Friends.setBounds(10, 100, 113, 25);
contentPane.add(Friends);
final JCheckBox Clan = new JCheckBox("Clan");
Clan.setBounds(10, 128, 113, 25);
contentPane.add(Clan);
JCheckBox Public = new JCheckBox("Public");
Public.setEnabled(false);
Public.setSelected(true);
Public.setBounds(10, 70, 113, 25);
contentPane.add(Public);
JButton btnHello = new JButton();
btnHello.setSize(143, 40);
btnHello.setLocation(89, 175);
btnHello.setText("Credits!");
contentPane.add(btnHello);
btnHello.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try {
create();
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btn_Start.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
stop = false;
btn_Start.setVisible(false);
btn_Stop.setVisible(true);
// Create a new Thread to do the counting
final Thread t = new Thread() {
@Override
public void run() { // override the run() for the running behaviors
try {
Friends.setEnabled(false);
Clan.setEnabled(false);
textField.setEnabled(false);
if(Friends.isSelected() && Clan.isSelected()){
friendsChat = true;
clanChat = false;
doubleChat = true;
}
else if (Friends.isSelected() && !Clan.isSelected()){
friendsChat = true;
clanChat = false;
}
else if(!Friends.isSelected() && Clan.isSelected()){
friendsChat = false;
clanChat = true;
}
friendsChat = false;
clanChat = false;
o = 1;
char next = 'v';
boolean continueHolder = true;
Robot robot = new Robot();
//--------------------------------------------------------
// Causes the values to be deleted when ran through multiple times, as bugs were occurring before this was implemented.
host = null;
wager = null;
level = null;
//--------------------------------------------------------
host = "Mistro";
wager = textField.getText();
level = "200";
if(wager.equals(""))
line = "white: Ready on " + host;
else
line = "cyan: " + wager + " on " + host;
char[] output = line.toCharArray();
try {
Thread.sleep(3500);
}
catch (InterruptedException e1) {
}
while(continueHolder)
for(int i = 0; i < output.length; i++){
if(i == 0){
if(o == 5){
o = 1;
if(doubleChat){
if(friendsChat){
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
friendsChat = false;
clanChat = true;
}
else if (clanChat){
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
clanChat = false;
friendsChat = true;
}
}
else if(friendsChat){
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
}
else if(clanChat){
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
try {
Thread.sleep(number);
}
catch (InterruptedException e1) {
}
robot.keyPress(KeyEvent.VK_SLASH);
robot.keyRelease(KeyEvent.VK_SLASH);
}
}
}
if(i == (output.length - 1))
o++;
if (stop){ robot = null; Thread.currentThread().interrupt(); break;}
number = (int) (Math.random() * 35) + 109;
next = output[i];
try {
Thread.sleep(number);
}
catch (InterruptedException e1) {
}
if(Character.isLowerCase(next)){
if(next == 'a'){
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);}
else if(next == 'b')
{robot.keyPress(KeyEvent.VK_B);
robot.keyRelease(KeyEvent.VK_B);}
else if(next == 'c')
{robot.keyPress(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_C);}
else if(next == 'd')
{robot.keyPress(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_D);}
else if(next == 'e')
{robot.keyPress(KeyEvent.VK_E);
robot.keyRelease(KeyEvent.VK_E);}
else if(next == 'f')
{robot.keyPress(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_F);}
else if(next == 'g')
{robot.keyPress(KeyEvent.VK_G);
robot.keyRelease(KeyEvent.VK_G);}
else if(next == 'h')
{robot.keyPress(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_H);}
else if(next == 'i')
{robot.keyPress(KeyEvent.VK_I);
robot.keyRelease(KeyEvent.VK_I);}
else if(next == 'j')
{robot.keyPress(KeyEvent.VK_J);
robot.keyRelease(KeyEvent.VK_J);}
else if(next == 'k')
{robot.keyPress(KeyEvent.VK_K);
robot.keyRelease(KeyEvent.VK_K);}
else if(next == 'l')
{robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);}
else if(next == 'm')
{robot.keyPress(KeyEvent.VK_M);
robot.keyRelease(KeyEvent.VK_M);}
else if(next == 'n')
{robot.keyPress(KeyEvent.VK_N);
robot.keyRelease(KeyEvent.VK_N);}
else if(next == 'o')
{robot.keyPress(KeyEvent.VK_O);
robot.keyRelease(KeyEvent.VK_O);}
else if(next == 'p')
{robot.keyPress(KeyEvent.VK_P);
robot.keyRelease(KeyEvent.VK_P);}
else if(next == 'q')
{robot.keyPress(KeyEvent.VK_Q);
robot.keyRelease(KeyEvent.VK_Q);}
else if(next == 'r')
{robot.keyPress(KeyEvent.VK_R);
robot.keyRelease(KeyEvent.VK_R);}
else if(next == 's')
{robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_S);}
else if(next == 't')
{robot.keyPress(KeyEvent.VK_T);
robot.keyRelease(KeyEvent.VK_T);}
else if(next == 'u')
{robot.keyPress(KeyEvent.VK_U);
robot.keyRelease(KeyEvent.VK_U);}
else if(next == 'v')
{robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);}
else if(next == 'w')
{robot.keyPress(KeyEvent.VK_W);
robot.keyRelease(KeyEvent.VK_W);}
else if(next == 'x')
{robot.keyPress(KeyEvent.VK_X);
robot.keyRelease(KeyEvent.VK_X);}
else if(next == 'y')
{robot.keyPress(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_Y);}
else if(next == 'z')
{robot.keyPress(KeyEvent.VK_Z);
robot.keyRelease(KeyEvent.VK_Z);}
if (i == output.length -1){
try {
Thread.sleep(number);
}
catch (InterruptedException e1) {
}
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
}
else
if(Character.isUpperCase(next)){
if(next == 'A'){
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'B')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_B);
robot.keyRelease(KeyEvent.VK_B);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'C')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'D')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'E')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_E);
robot.keyRelease(KeyEvent.VK_E);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'F')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'G')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_G);
robot.keyRelease(KeyEvent.VK_G);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'H')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'I')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_I);
robot.keyRelease(KeyEvent.VK_I);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'J')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_J);
robot.keyRelease(KeyEvent.VK_J);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'K')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_K);
robot.keyRelease(KeyEvent.VK_K);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'L')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'M')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_M);
robot.keyRelease(KeyEvent.VK_M);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'N')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_N);
robot.keyRelease(KeyEvent.VK_N);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'O')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_O);
robot.keyRelease(KeyEvent.VK_O);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'P')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_P);
robot.keyRelease(KeyEvent.VK_P);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'Q')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_Q);
robot.keyRelease(KeyEvent.VK_Q);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'R')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_R);
robot.keyRelease(KeyEvent.VK_R);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'S')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'T')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_T);
robot.keyRelease(KeyEvent.VK_T);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'U')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_U);
robot.keyRelease(KeyEvent.VK_U);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'V')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'W')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_W);
robot.keyRelease(KeyEvent.VK_W);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'X')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_X);
robot.keyRelease(KeyEvent.VK_X);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'Y')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == 'Z')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_Z);
robot.keyRelease(KeyEvent.VK_Z);
robot.keyRelease(KeyEvent.VK_SHIFT);}
if (i == output.length -1){
try {
Thread.sleep(number);
}
catch (InterruptedException e1) {
}
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);}
}
else
{if(next == '0')
{robot.keyPress(KeyEvent.VK_0);
robot.keyRelease(KeyEvent.VK_0);}
else if(next == '1')
{robot.keyPress(KeyEvent.VK_1);
robot.keyRelease(KeyEvent.VK_1);}
else if(next == '2')
{robot.keyPress(KeyEvent.VK_2);
robot.keyRelease(KeyEvent.VK_2);}
else if(next == '3')
{robot.keyPress(KeyEvent.VK_3);
robot.keyRelease(KeyEvent.VK_3);}
else if(next == '4')
{robot.keyPress(KeyEvent.VK_4);
robot.keyRelease(KeyEvent.VK_4);}
else if(next == '5')
{robot.keyPress(KeyEvent.VK_5);
robot.keyRelease(KeyEvent.VK_5);}
else if(next == '6')
{robot.keyPress(KeyEvent.VK_6);
robot.keyRelease(KeyEvent.VK_6);}
else if(next == '7')
{robot.keyPress(KeyEvent.VK_7);
robot.keyRelease(KeyEvent.VK_7);}
else if(next == '8')
{robot.keyPress(KeyEvent.VK_;
robot.keyRelease(KeyEvent.VK_;}
else if(next == '9')
{robot.keyPress(KeyEvent.VK_9);
robot.keyRelease(KeyEvent.VK_9);}
else if(next == ' ')
{robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);}
else if(next == '>')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_PERIOD);
robot.keyRelease(KeyEvent.VK_PERIOD);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == '<')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_COMMA);
robot.keyRelease(KeyEvent.VK_COMMA);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == '!')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_1);
robot.keyRelease(KeyEvent.VK_1);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == ',')
{robot.keyPress(KeyEvent.VK_COMMA);
robot.keyRelease(KeyEvent.VK_COMMA);}
else if(next == '.')
{robot.keyPress(KeyEvent.VK_PERIOD);
robot.keyRelease(KeyEvent.VK_PERIOD);}
else if(next == '[')
{robot.keyPress(KeyEvent.VK_OPEN_BRACKET);
robot.keyRelease(KeyEvent.VK_OPEN_BRACKET);}
else if(next == ']')
{robot.keyPress(KeyEvent.VK_CLOSE_BRACKET);
robot.keyRelease(KeyEvent.VK_CLOSE_BRACKET);}
else if(next == '@')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_2);
robot.keyRelease(KeyEvent.VK_2);
robot.keyRelease(KeyEvent.VK_SHIFT);}
else if(next == ':')
{robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_SEMICOLON);
robot.keyRelease(KeyEvent.VK_SEMICOLON);
robot.keyRelease(KeyEvent.VK_SHIFT);}
if (i == output.length -1){
try {
Thread.sleep(number);
}
catch (InterruptedException e1) {
}
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
try {
Thread.sleep((int) (Math.random() * 2592) + 1843);
}
catch (InterruptedException e1) {
}
}
}
}
} catch (AWTException e1) {
e1.printStackTrace();}
}
};
t.start(); // call back run()
}}
);
btn_Stop.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
btn_Start.setVisible(true);
btn_Stop.setVisible(false);
Friends.setEnabled(true);
Clan.setEnabled(true);
http://choice.setEnabled(true);
textField.setEnabled(true);
http://textField_1.setEnabled(true);
textField.setText("");
Friends.setSelected(false);
Clan.setSelected(false);
stop = true;
}
});
}
public static void create() throws URISyntaxException{
final URI uri = new URI("http://www.coradyce.com/t16707-mistro-s-host-app-newsletter-writer-high-roller-trusted-w-211m-sponsor-4b-wagered-145m-given-away-100-hours-adv-29-vouches");
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e) { /* TODO: error handling */ }
} else { /* TODO: error handling */ }
}
@Override
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}