Skip to content

Instantly share code, notes, and snippets.

@maijou2501
Created May 21, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maijou2501/04c67f7ccc5878b70839 to your computer and use it in GitHub Desktop.
Save maijou2501/04c67f7ccc5878b70839 to your computer and use it in GitHub Desktop.
pre setting, click system
import java.awt.MouseInfo;
import java.awt.PointerInfo;
import java.awt.Robot;
import java.awt.*;
import java.awt.event.InputEvent;
import java.util.Scanner;
public class Click {
public static void MouseLocation() {
PointerInfo pointerInfo = MouseInfo.getPointerInfo();
System.out.println("Location of Mouse : " + pointerInfo.getLocation());
}
public static void main(String[] args){
Robot r;
try { r = new Robot(); }
catch(AWTException e){
e.printStackTrace();
return;
}
/* for(int i=0;i<5;i++){
MouseLocation();
try {
Thread.sleep(2000L);
} catch (InterruptedException ex) {
break;
}
}
Scanner stdIn = new Scanner(System.in);
System.out.print("x1=");
int x1 = stdIn.nextInt();
System.out.print("y1=");
int y1 = stdIn.nextInt();
System.out.print("x2=");
int x2 = stdIn.nextInt();
System.out.print("y2=");
int y2 = stdIn.nextInt();
System.out.print("x3=");
int x3 = stdIn.nextInt();
System.out.print("y3=");
int y3 = stdIn.nextInt();
*/
int x1 = 1106;
int y1 = 711;
int x2 = 1109;
int y2 = 62;
int x3 = 631;
int y3 = 455;
int x4 = 735;
int y4 = 489;
int x5 = 770;
int y5 = 276;
// Phase_1
try {
Thread.sleep(2000L);
}catch (InterruptedException ex) {
}
for(int n=1;n<14;n++){
r.mouseMove(x1,y1);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(240000L);
} catch (InterruptedException ex) {
break;
}
}
// Phase_2
r.mouseMove(x2,y2);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(5000L);
} catch (InterruptedException ex) {
}
// Phase_3
r.mouseMove(x3,y3);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(5000L);
} catch (InterruptedException ex) {
}
// Phase_4
r.mouseMove(x4,y4);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(5000L);
} catch (InterruptedException ex) {
}
// Phase_5
r.mouseMove(x5,y5);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(5000L);
} catch (InterruptedException ex) {
}
for(int n=1;n<30;n++){
r.mouseMove(x5,y5);
r.mousePress(InputEvent.BUTTON1_MASK);
r.mouseRelease(InputEvent.BUTTON1_MASK);
try {
Thread.sleep(240000L);
} catch (InterruptedException ex) {
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment