Saturday, September 25, 2010

Click Robot

I came across many games in Internet which wanted to measure my mouse clicking abilities and. So I decided to write a bot which can click at the given coordinate endlessly. The code is in Java. I have also explained the code in comments where ever required.
-------------------------------------------

// Automatic Click Bot in JAVA by Sriram.A.S. (sriramdasty7@gmail.com)
import java.awt.Robot;
import java.awt.event.InputEvent;
class mouse extends Robot
{
int i;
public mouse() throws Exception
{
i=1;
}
public static void main(String ar[]) throws Exception
{
mouse robot=new mouse();
/* This is the coordinate that i want to click. Change the x,y value where you want to click on the screen */
robot.mouseMove(403,580);
while(true)
{
//First i press mouse
robot.mousePress(InputEvent.BUTTON1_MASK);
//Then i release it
robot.mouseRelease(InputEvent.BUTTON1_MASK);
/* This i counter is just for safety, if you use an infinite loop, the program mich not stop and it will keep on clicking, so i stop clicking after 1200 times */
robot.i++;
if(robot.i==1200)
break;
}
}
}

-------------------------------------------

You can use this code for clicking a x,y coordinate on your screen infinitely!!

No comments:

Post a Comment