0% found this document useful (0 votes)
111 views2 pages

Auto Clicker Java

This Java program implements an autoclicker that prompts the user for the number of clicks and the maximum speed of clicking in milliseconds. It uses the Robot class to simulate mouse clicks at a random interval until the specified number of clicks is reached or the mouse is moved. The program includes error handling for user input and provides feedback on the current mouse position and click count.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views2 pages

Auto Clicker Java

This Java program implements an autoclicker that prompts the user for the number of clicks and the maximum speed of clicking in milliseconds. It uses the Robot class to simulate mouse clicks at a random interval until the specified number of clicks is reached or the mouse is moved. The program includes error handling for user input and provides feedback on the current mouse position and click count.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

package me.Demonly.

auto;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.concurrent.ThreadLocalRandom;

public class clicker {


public static boolean clicking = true;
public static int amountclicked = 0;
public static int rate = 0;
public static int rate1 = 0;

public static void main(String[] args) throws InterruptedException {

while (rate1 == 0) {
try {
System.out.println("How many clicks are you wanting to
do?:");
BufferedReader xyz = new BufferedReader(new
InputStreamReader(System.in));
try {
rate1 = Integer.parseInt(xyz.readLine());
if (rate1 == 0) {
rate1 = 0;
System.out.println("Must be at least 1
click.");
}
} catch (NumberFormatException ex) {
System.out.println("Error - please try again.");
}
} catch (IOException e) {
}
}

while (rate == 0) {
try {
System.out.println("Max speed of the autoclicker?: (in
miliseconds):");
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
try {
rate = Integer.parseInt(in.readLine());
if (rate < 500) {
rate = 0;
System.out.println("Must be at least 500
miliseconds.");
}
} catch (NumberFormatException ex) {
System.out.println("Error - please try again.");
}
} catch (IOException e) {
}
}

try {
System.out.println("*!*!*!*! PLEASE MOVE YOUR MOUSE INTO
POSITION! !*!*!*!*");
System.out.println("*!*!*!*! MOVE MOUSE TO END AUTOCLICK! !*!*!*!
*");
System.out.println("*!*!*!*! Sleeping for 10 seconds !*!*!*!*");

Thread.sleep(10000);

Point p = MouseInfo.getPointerInfo().getLocation();
System.out.println("Current Mouse Location: "+p);

Robot robot = new Robot();


while (clicking == true) {
try {
Point z = MouseInfo.getPointerInfo().getLocation();
System.out.println("Current Mouse Location: "+z);

int randomNum =
ThreadLocalRandom.current().nextInt(15000, rate + 1);
System.out.println("Current Rate: " + randomNum);
Thread.sleep(randomNum);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
amountclicked++;
System.out.println("Amount Clicked So Far: " +
amountclicked);

if (Math.round(z.getX()+z.getY()) !=
Math.round(p.getX()+p.getY())) {
System.out.println("MOUSE MOVED!: "+z);
clicking = false;
}

if (amountclicked == rate1) {
clicking = false;
}
} catch (InterruptedException ex) {
}
}
} catch (AWTException e) {
}

You might also like