Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.Robot;
- import java.util.Random;
- import java.util.Scanner;
- import static java.awt.event.KeyEvent.*;
- public class AutoType {
- private static int[] letters = {VK_A, VK_B, VK_C, VK_D, VK_E, VK_F, VK_G, VK_H, VK_I, VK_J, VK_K, VK_L, VK_M, VK_N, VK_O, VK_P, VK_Q, VK_R, VK_S, VK_T, VK_U, VK_V, VK_W, VK_X, VK_Y, VK_Z};
- private static String[] colors = {
- "",
- "red:",
- "green:",
- "cyan:",
- "purple:",
- "white:",
- "flash1:",
- "flash2:",
- "flash3:",
- "glow1:",
- "glow2:",
- "glow3:"
- };
- private static String[] effects = {
- "",
- "wave:",
- "wave2:",
- "shake:",
- "slide:",
- "scroll:"
- };
- private static String[] messages = {
- "~~ blessing people for donations ~ pick any god ~~",
- "~~ godly blessings for donations ~ god of your choice ~~",
- "god choices: armadyl/bandos/guthix/saradomin/zamorak/zaros"
- };
- public static void main(String[] args) throws AWTException {
- Robot rob = new Robot();
- Random rand = new Random();
- Scanner in = new Scanner(System.in);
- boolean again = true;
- while (again) {
- for (int j = 0; j < 3; ++j) {
- wait(4000 + rand.nextInt(2000));
- String randomColor = colors[rand.nextInt(colors.length)];
- String randomEffect = effects[rand.nextInt(effects.length)];
- String message = randomColor + randomEffect + messages[j];
- System.out.println(message);
- for (int i = 0; i < message.length(); ++i) {
- press(rob, message.charAt(i));
- wait(10 + rand.nextInt(5));
- }
- press(rob, (char) 0);
- }
- System.out.print("Again? (type anything to continue) ");
- again = !in.nextLine().isEmpty();
- }
- }
- public static void press(Robot rob, char letter) {
- boolean holdShift = letter == '~' || letter == ':';
- int keyCode =
- (letter == ' ') ? VK_SPACE :
- (letter == '~') ? VK_BACK_QUOTE :
- (letter == '/') ? VK_SLASH :
- (letter == ':') ? VK_SEMICOLON :
- (letter == '1') ? VK_1 :
- (letter == '2') ? VK_2 :
- (letter == '3') ? VK_3 :
- (letter == 0) ? VK_ENTER :
- letters[(letter - 'a')];
- if (holdShift) {
- rob.keyPress(VK_SHIFT);
- }
- rob.keyPress(keyCode);
- rob.keyRelease(keyCode);
- if (holdShift) {
- rob.keyRelease(VK_SHIFT);
- }
- }
- public static void wait(int ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment