6

【笔记】按键精灵 2014

 1 year ago
source link: https://loli.fj.cn/2023/06/21/%E6%8C%89%E9%94%AE%E7%B2%BE%E7%81%B52014/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】按键精灵 2014

2023-06-21

按键精灵 2014 学习笔记
按键精灵 2014 的脚本基于 VB,源码的后缀名为.Q

// 注释内容

' 注释内容

<num>:延迟的时间,单位毫秒

Delay <num>
变量名 = 变量值

逻辑运算符

  • And

Where 循环

  • 如果无限循环,循环条件设置为 True
While 循环条件
...
Wend

For 循环

<num>:循环次数

For <num>
...
Next
IF 条件 Then
...
ElseIf 条件
...
End If

<x>:x 轴坐标
<y>:y 轴坐标
FFFFFF:十六进制颜色值
0 表示相同,1 表示不相同,2 表示相似

IfColor <x>,<y>,"FFFFFF",0 Then
...
Else
...
End If
  • 在一个区域内从左上角开始找色,按照先从左再到右、先从上再到下的顺序

<x_start>,<y_start>:选区左上角的横纵坐标
<x_end>,<y_end>:选区右下角的横纵坐标
intX:返回值,找到的结果 x 坐标,如果找不到就返回小于 1 的数
intY:返回值,找到的结果 y 坐标,如果找不到就返回小于 1 的数

FindColor <x_start>,<y_start>,<x_end>,<y_end>,"FFFFFF",intX,intY
If intX > 0 And intY > 0 Then
...
End If

<mod>:指定找色模式

0:从左上到右下
1:从中心开始
2:从右下到左上

<similarity>:指定颜色相似度,范围 [0,1]

FindColorEx <x_start>,<y_start>,<x_end>,<y_end>,"FFFFFF",<mod>,<similarity>,intX,intY
If intX > 0 And intY > 0 Then
...
End If
  • 先将图片添加到附件

按键精灵只能识别.bmp 格式的位图
不能找单色图片

  • 再在代码中引用图片

<filename>.bmp:附件中的图片名

FindPic <x_start>,<y_start>,<x_end>,<y_end>,"<filename>.bmp",<similarity>,intX,intY
If intX > 0 And intY > 0 Then
...
End If
  • 屏幕坐标系的原点为屏幕左上角,向右为 x 轴的正方向,向下为 y 轴的正方向

<x>:x 轴坐标
<y>:y 轴坐标

MoveTo <x>,<y>

<num>:单机次数

LeftClick <num>

哔哩哔哩 —— 酷玩蚊仔


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK