金猪脚本(原飞猪脚本)以按键精灵教学为主,涉及UiBot,Python,Lua等脚本编程语言,教学包括全自动办公脚本,游戏辅助脚本,引流脚本,网页脚本,安卓脚本,IOS脚本,注册脚本,点赞脚本,阅读脚本以及网赚脚本等各个领域。想制作脚本和学习按键精灵的朋友可以添加按键精灵学习交流群:554127455 学习路上不再孤单,金猪脚本伴你一同成长.
NO.1-同步的前提
[backcolor=rgb(46, 139, 87)]前提
[backcolor=rgb(154, 205, 50)] 1 同步的两个窗口需要是同一个应用窗口,并且窗口大小要相同
[backcolor=rgb(154, 205, 50)] 2 同步窗口可以接收到按键的键鼠发送信息
[backcolor=rgb(154, 205, 50)] 3 [backcolor=rgb(255, 255, 255)]同步的窗口支持后台键鼠操作
NO.2-本节例子及其能实现的功能
[backcolor=rgb(46, 139, 87)]例子
[backcolor=rgb(154, 205, 50)] 1 画图工具,实现同步画图
[backcolor=rgb(154, 205, 50)] 2 记事本,实现同步删除内容
[backcolor=rgb(154, 205, 50)] 功能 ① 键鼠同步
② 支持组合键
NO.3-思路大剖析
[backcolor=rgb(46, 139, 87)]思路步骤
[backcolor=rgb(154, 205, 50)]1 获取主窗口和被同步窗口句柄
● WaitKey 命令等待键盘按下
○ 按下F6则获取当前鼠标指向的窗口句柄,作为主窗口句柄。
○ 按下F7 则获取当前鼠标指向的窗口句柄,作为同步窗口句柄。
● 用Do循环来等待按键,当主窗口句柄和同步窗口句柄都获取到时,退出Do循环
● [backcolor=rgb(105, 105, 105)]代码
- Do
- Key = WaitKey()
- If Key = 117 Then
- 主窗口 = Plugin.Window.MousePoint()
- End If
- If Key = 118 Then
- 同步窗口 = Plugin.Window.MousePoint()
- End If
- Delay 500
- If 主窗口 [backcolor=rgb(154, 205, 50)]2 设置两个窗口的窗口大小一致
- ● 窗口大小一致,同步的时候鼠标才能移动到正确的位置。
- ● [backcolor=rgb(105, 105, 105)]代码 0 and 同步窗口 [backcolor=rgb(154, 205, 50)]3 获取主窗口的左上角坐标
- ● GetWindowRect 命令获取主窗口的左上角坐标
- ● [backcolor=rgb(105, 105, 105)]代码 0 Then
- Exit Do
- End If
- Loop
复制代码
[backcolor=rgb(154, 205, 50)]4 获取当前鼠标在主窗口的位置
● GetCursorPos命令获取当前鼠标位置
● [backcolor=rgb(105, 105, 105)]代码
- Call Plugin.Window.Size(主窗口,800,600)
- Call Plugin.Window.Size(同步窗口,800,600)
复制代码
[backcolor=rgb(154, 205, 50)]5 计算主窗口内当前鼠标位置和窗口左上角距离
● 公式:当前鼠标位置减去窗口左上角坐标值([backcolor=rgb(247, 247, 247)] mx-L, my-T)
[backcolor=rgb(154, 205, 50)]6 开始同步
● 被同步窗口,使用按键后台键鼠命令,将鼠标移动到和主窗口相同的位置
( 按键后台命令鼠标移动是以窗口客户区左上角坐标为基点)
● [backcolor=rgb(105, 105, 105)]代码
- sRect = Plugin.Window.GetWindowRect(主窗口)
- dim MyArray
- MyArray = Split(sRect, "|")
- L = Clng(MyArray(0)): T = Clng(MyArray(1))
复制代码
●在主窗口内按下任意键时,同步窗口也执行同样的操作
● [backcolor=rgb(105, 105, 105)]代码
- GetCursorPos mx, my
复制代码
NO.4-代码
[backcolor=rgb(46, 139, 87)]代码
- Call Plugin.Bkgnd.MoveTo(同步窗口, mx-L, my-T)
复制代码
NO.5-效果演示
[backcolor=rgb(46, 139, 87)]演示
[backcolor=rgb(154, 205, 50)] 画图[backcolor=rgb(154, 205, 50)]
[backcolor=rgb(154, 205, 50)] 记事本[backcolor=rgb(154, 205, 50)]
[backcolor=rgb(105, 105, 105)]注意 画图和记事本,获取窗口句柄的时候请点击白白的客户区进行获取,因为我们是要对它的客户区进行操作
NO.6-温馨小提示
[backcolor=rgb(46, 139, 87)]温馨小提示
[backcolor=rgb(154, 205, 50)] [backcolor=rgb(154, 205, 50)]*[backcolor=rgb(154, 205, 50)] 游戏窗口中的同步,需要注意几个窗口中人物的朝向和坐标是否相同[backcolor=rgb(154, 205, 50)]
[backcolor=rgb(154, 205, 50)] [backcolor=rgb(154, 205, 50)]*[backcolor=rgb(154, 205, 50)] 如果坐标朝向不同,一个窗口里的角色往西边走一个往北边走,就无法达到预期同步任务的效果
本文暂时没有评论,来添加一个吧(●'◡'●)