-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoxClicker.java
58 lines (46 loc) · 2.14 KB
/
BoxClicker.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.event.InputEvent;
public class BoxClicker {
public static void main(final String[] args) {
try {
// make robot object
final Robot bobTheClicker = new Robot();
// gather & print screen data
System.out.println("Gathering screen dimensions");
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final int screenHeight = screenSize.height;
final int screenWidth = screenSize.width;
System.out.println("Screen width: " + screenWidth + ", height: " + screenHeight + "\n\n");
final int[] centerPoint = { screenWidth / 2, screenHeight / 2 };
bobTheClicker.mouseMove(centerPoint[0], centerPoint[1]);
int clicks = 0;
while(clicks < 1000) {
final double radius = 100;
double theta = 0;
final double h = centerPoint[0];
final double k = centerPoint[1];
double step = (double) ((int) (Math.random() * 50 + 1));
while (theta <= 360) {
if (clicks >= 1000) break;
final int[] circleCoord = { (int) (h + radius * Math.cos(theta)),
(int) (k + radius * Math.sin(theta)) };
//System.out.println(circleCoord[0] + " " + circleCoord[1]);
bobTheClicker.mouseMove(circleCoord[0], circleCoord[1]);
Thread.sleep((int) (Math.random() * 70 + 31));
// sprinkle in some randomness
step = (double) ((int) (Math.random() * 50 + 1));
// click
bobTheClicker.mousePress(InputEvent.BUTTON1_DOWN_MASK);
bobTheClicker.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
clicks++;
System.out.print('.'); // System.out.print(clicks);
theta += step;
}
}
} catch (final Exception e) {
System.out.print(e);
}
}
}