package com.zhiyou;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.sql.SQLOutput;
public class MassTexting {
public static void main(String[] args) throws AWTException {
MassTexting(200);
}
public static void MassTexting(int num) {
try {
Robot robot = new Robot();
System.out.println("切换屏幕");
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_TAB);
System.out.println("休眠2秒");
robot.delay(2000);
for (int i = 0; i < num; i++){
System.out.println("粘贴");
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_V);
System.out.println("发送消息");
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
System.out.println("休眠2秒");
robot.delay(2000);
for(int j = 0; j < i; j++) {
System.out.println("往下走哦"+i+"个聊天窗口");
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyRelease(KeyEvent.VK_DOWN);
}
System.out.println("运行结束");
}
}catch (AWTException e) {
e.printStackTrace();
}
}
}
|