zoukankan      html  css  js  c++  java
  • 鼠标

    一、代码如下

    package www.woniu.auto;
    
    import java.awt.AWTException;
    import java.awt.Robot;
    import java.awt.event.InputEvent;
    import java.awt.event.KeyEvent;
    import java.io.IOException;
    
    public class RobotMouse {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		try {
    			//启动计算器
    			Runtime.getRuntime().exec("calc.exe");
    			Thread.sleep(3000);
    			
    			//鼠标操作
    			Robot robot= new Robot();
    			robot.mousePress(InputEvent.BUTTON1_MASK);
    			robot.mouseRelease(InputEvent.BUTTON1_MASK);
    			Thread.sleep(20000);
    			
    			robot.mousePress(InputEvent.BUTTON3_MASK);
    			robot.mouseRelease(InputEvent.BUTTON3_MASK);
    			Thread.sleep(20000);
    			
    			//程序退出
    			robot.keyPress(KeyEvent.VK_ALT);
    			robot.keyPress(KeyEvent.VK_F4);
    			robot.keyRelease(KeyEvent.VK_ALT);
    			robot.keyRelease(KeyEvent.VK_F4);
    			
    			
    		} catch (AWTException e) {
    			// TODO Auto-generated catch block  
    			e.printStackTrace();
    		} catch (InterruptedException e) {
    			// TODO Auto-generated catch block  InterruptedException  IOException
    			e.printStackTrace();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block  InterruptedException  IOException
    			e.printStackTrace();
    		}
    
    	}
    
    
    }
    
  • 相关阅读:
    chkconfig命令
    PHP中的WebService
    MySQL 中联合查询效率分析
    javascript中json对象长度
    Replace Pioneer
    c++ 调用matlab程序
    ubuntu 安装 sublime
    一些地址收藏
    学习笔记草稿
    Redis Cluster 集群使用(3)
  • 原文地址:https://www.cnblogs.com/wujianbo123/p/7465702.html
Copyright © 2011-2022 走看看