- //这里展示了鼠标 历时5秒 从屏幕左上角移动到屏幕右上角的例子,下面是参数说明
- //参数:平滑灵敏度说明:整形,范围1~其实坐标差最大值,鼠标单次跨越的距离。
- //移动总时间越长或起始坐标距离越短,平滑灵敏度越小越好
- //反之,越大越准确,但一般不超过起始坐标最大差值的10%
- //设置灵敏度是为了调节delay函数延时太短时,无法准确执行延时
- Function 平滑移动鼠标to(终点坐标px,终点坐标py,移动时间,起点坐标beginx,起点坐标beginy,平滑灵敏度)
- dim mx
- dim x,y
- dim tx,ty
- x=起点坐标beginx
- y=起点坐标beginy
- tx=abs(x-终点坐标px)
- ty=abs(y-终点坐标py)
- if tx>=ty
- mx=tx
- else
- mx=ty
- end if
- if mx>0
- for i = 0 to mx step 平滑灵敏度
- sx=int((终点坐标px*i+x*(mx-i))/mx)
- sy=int((终点坐标py*i+y*(mx-i))/mx)
- moveto sx,sy
- delay int(移动时间/mx*平滑灵敏度)
- Next
- else
- delay 移动时间
- end if
- MoveTo 终点坐标px, 终点坐标py
- 平滑移动鼠标to=true
- End Function
联系客服