鼠标移动,点击,拖动模拟
import win
import mouse
//返回鼠标当前位置
var $x,$y = mouse.getPos()
win.msgbox($x "," $y)
//从当前位置x 100,y 200移动(相对位置移动)
mouse.move(100,200)
//第三参数为true,按屏幕位置移动(绝对位置移动)
mouse.move(100,200,true)
//上面是直接设置鼠标位置,看不见轨迹
//moveTo移动鼠标位置可见轨迹
mouse.moveTo(300,400,true)
//默认步进8,2毫秒延时,改为步进2,100毫秒延时
mouse.moveTo(700,800,true,2,100)
//在当前位置点击
mouse.click()
//指定位置点击
mouse.click(300,500,true)
//双击
mouse.clickDb()
mouse.clickDb(300,500,true)
//右键点击
mouse.rb.click()
//鼠标中键向下滚动1000
mouse.mb.roll(-1000)
//拖动鼠标
mouse.drag(500,100)
//小例子
import process
//打开计算器并用鼠标拖动窗口
process.execute("calc.exe")
sleep(2000)
var $hwnd = win.find(,"计算器")
var $x,$y = win.getPos($hwnd,true)
mouse.move($x 50,$y 10,true)
mouse.drag(300,400,true)