使用说明:按下热键2,即可启动脚本。 运行环境:分辨率:1024x768 色深:32位 操作系统:Win
@vrBrothers.Leo .9//初始化的工作
Dim hWnd
Dim ax,ay,bx,by
set TiShiObj = createobject("WScript.Shell")
//鼠标移到屏幕正中并保存位置,这样可以显示较长时间的鼠标移动轨迹
YiDongSuDu=3
Gosub YiDaoZhongJian
SaveMousePos
MoveTo 0,0
//先说明一下脚本的功能
Gosub ShuoMing
//按顺序执行各个功能模块
Gosub LuZhi
Gosub BaoCunTuiChu
EndScript
//功能模块0:介绍这个脚本的基本情况
Sub ShuoMing
TiShiXinXi = "【按键精灵】动起来教程 2.0讲,制作:vrBrothers.Leo"&vbCrLf&"本教程完全自动,请勿在脚本运行时接触键盘和鼠标!"
Gosub TiShi
TiShiXinXi = "本讲介绍如何录制脚本;所需时间:1分30秒"
Gosub TiShi
TiShiXinXi = "录制功能是按键精灵最大的特色之一"
Gosub TiShi
TiShiXinXi = "就像【录像机】一样把你的动作录制成脚本,以后随时回放"
Gosub TiShi
TiShiXinXi = "下面我们介绍录制功能的具体使用"
Gosub TiShi
Return ShuoMing
//功能模块1:主界面移动鼠标到录制按钮,按下鼠标打开录制窗口
Sub LuZhi
//打开了录制界面
TiShiXinXI = "进入录制界面后主要有3个功能:录制、停止、保存。"
Gosub TiShi
TiShiXinXI = "开始录制脚本有两种方式:点录制按钮或者按下ScrollLock按钮"
Gosub TiShi
TiShiXinXI = "录制完毕之后可点击停止按钮或者再次按下ScrollLock按钮停止"
Gosub TiShi
TiShiXinXI = "点保存按钮即可将录制的动作保存为脚本"
Gosub TiShi
TiShiXinXI = "现在我们进入录制界面,录制一个脚本并保存"
Gosub TiShi
//录制按钮的相对地址
RestoreMousePos
bxOpp = 296:byOpp = 47
Gosub GetABPoint
//Call MessageBox(ax&"|"&ay&"|"&bx&"|"&by)
Gosub ManManYiDong
Delay 2000
LeftClick 1
//等待录制界面出现
Delay 3000
KeyPress 145,1
Delay 2000
Gosub 画圆
Delay 2000
KeyPress 145,1
//移动到保存按钮。保存按钮相对坐标是(80,30),录制界面宽度是244,因此保存按钮的位置就是屏幕中央坐标的x-244/2+80=x-42
RestoreMousePos
MoveR -42,0
Delay 2000
LeftClick 1
Delay 2000
Return LuZhi
//功能模块2:保存退出脚本编辑器
Sub BaoCunTuiChu
TiShiXinXI = "现在录制的动作已经成功记录为脚本"&vbCrLf&"您应该可以看到许多的脚本命令"
Gosub TiShi
TiShiXinXI = "接下来我们保存脚本退出"
Gosub TiShi
bxOpp=91:byOpp=53
Gosub GetABPoint
YiDongSuDu = 10
Gosub ManManYiDong
LeftClick 1
Delay 1000
KeyPress 13,1
Delay 1000
TiShiXinXI = "恭喜您录制的脚本诞生了 :)"&vbCrLf&"现在脚本列表里会多出一个『我的脚本』"
Gosub TiShi
TiShiXinXI = "当您按下脚本的启动热键 F10 "&vbCrLf&"脚本即可帮你回放刚才的动作 "
Gosub TiShi
TiShiXinXI = "本教程演示完毕!"&vbCrLf&"快点试试您录制的第一个脚本吧!"
Gosub TiShi
Return BaoCunTuiChu
//常用:把鼠标从a点慢慢移动到b点
Sub ManManYiDong
PianYiX = ax-bx
PianYiY = ay-by
Rem YiDong
If PianYiX<>0 or PianYiY<>0
YiDongX =0
YiDongY =0
If PianYiX<>0
YiDongX = -abs(PianYiX)/PianYiX
EndIf
If PianYiY<>0
YiDongY = -abs(PianYiY)/PianYiY
EndIf
MoveR YiDongX YiDongY
PianYiX = PianYiX + YiDongX
PianYiY = PianYiY + YiDongY
Delay YiDongSuDu
Goto YiDong
EndIf
Return ManManYidong
//常用:提示信息,过3秒自动关闭窗口的方式
Sub TiShi
Call TiShiObj.Popup(TiShiXinXi,3,"3秒后窗口自动关闭",0)
Return TiShi
//常用:获取A点和B点的坐标,A点是当前坐标点,B点是目的坐标点
Sub GetABPoint
//获取A点坐标信息
Call GetCursorPos(ax,ay)
//获取B点坐标信息,B点坐标 = 窗口坐标 + 相对坐标
Plugin hWnd=Window.Foreground()
Plugin winRect=Window.GetWindowRect(hWnd)
// MessageBox(winRect)
winPoint = Split(winRect, "|", -1, 1)
bx = CInt(winPoint(0)) + bxOpp
by = CInt(winPoint(1)) + byOpp
Return GetABPoint
//常用:把鼠标移动到屏幕正中
Sub YiDaoZhongJian
Call GetScreenResolution(intX,intY)
MoveTo intX/2,intY/2
Return YiDaoZhongJian
//常用:屏幕上画圆
Sub 画圆
r=300:x0=512:y0=384:x=0:y=0:n=0
While n<3.1415926*2
x=x0+r*cos(n)
y=y0-r*sin(n)
MoveTo x,y
Delay 10
n=n+0.03
EndWhile
Return 画圆
来源:三叶资源网,欢迎分享,公众号:iisanye,(三叶资源网④群:72857039)