Last active
September 10, 2025 14:16
-
-
Save brunogamacatao/f29625de651521247f195c91ab31d870 to your computer and use it in GitHub Desktop.
Automatic Mouse Mover and Clicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import java.util.*; | |
public class NaoEncheOSaco { | |
public static void main(String[] args) { | |
final Toolkit toolkit = Toolkit.getDefaultToolkit(); | |
final Dimension screenSize = toolkit.getScreenSize(); | |
new Thread(() -> { | |
System.out.println("Executando, pressione control+C para sair"); | |
while (true) { | |
try { | |
Robot robot = new Robot(); | |
robot.delay(500); | |
int x = (int)(Math.random() * screenSize.getWidth()) - 100; | |
int y = (int)(Math.random() * screenSize.getHeight()) - 100; | |
robot.mouseMove(50 + x, 50 + y); | |
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); | |
robot.delay(50); | |
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); | |
} catch (Exception ex) { | |
// continua rodando mesmo se tiver algum erro | |
} | |
} | |
}).start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compilar:
javac NaoEncheOSaco.java
executar:
java NaoEncheOSaco