使用按键精灵识别点击区域进行点击

🏷️ 365bet欧洲 📅 2025-11-06 17:36:20 👤 admin 👁️ 9323 ❤️ 860
使用按键精灵识别点击区域进行点击

使用按键精灵,我们可以录制脚本,根据组件坐标进行一些自动化的操作。

但是,有时组件的坐标可能不是一定的,会发生细微的变化。

我们可以根据图片识别点击区域进行点击。

一、获取点击区域图片

1.打开按键精灵软件,点击抓抓

2.点击图像->截屏->框选区域->位图另存为,存储位图(bmp)。

3.在附件中添加该位图(bmp)为附件。

二、书写脚本

1.新建一个脚本

2.输入如下代码

Dim intX, intY

Rem 开始找图

FindPic 0, 0, 1920, 1080, "Attachment:\test2.bmp", 0.9, intX, intY

TracePrint intX

TracePrint intY

If intX > 0 And intY > 0 Then

MoveTo intX+20,intY+20

LeftClick 1

Delay 100

Goto 开始找图

Else

Delay 500

Goto 开始找图

End If

其中,1920和1080是屏幕的分辨率。

3.点击调试->启动,则会输出点击区域图片的坐标值,并自动进行点击操作。

4.下面是寻找多个点击位置,并进行点击的代码

Dim intX, intY

Rem 开始找图

FindPic 0, 0, 1920, 1080, "Attachment:\circle.bmp", 0.9, intX, intY

TracePrint intX

TracePrint intY

If intX > 0 And intY > 0 Then

MoveTo intX+20,intY+20

LeftClick 1

Delay 100

Else

Delay 500

End If

FindPic 0, 0, 1920, 1080, "Attachment:\confirm.bmp", 0.9, intX, intY

TracePrint intX

TracePrint intY

If intX > 0 And intY > 0 Then

MoveTo intX+20,intY+20

LeftClick 1

Delay 100

Else

Delay 500

End If

FindPic 0, 0, 1920, 1080, "Attachment:\continue.bmp", 0.9, intX, intY

TracePrint intX

TracePrint intY

If intX > 0 And intY > 0 Then

MoveTo intX+20,intY+20

LeftClick 1

Delay 100

Else

Delay 500

End If

FindPic 0, 0, 1920, 1080, "Attachment:\next.bmp", 0.9, intX, intY

TracePrint intX

TracePrint intY

If intX > 0 And intY > 0 Then

MoveTo intX+20,intY+20

LeftClick 1

Delay 100

Else

Delay 500

End If

Goto 开始找图

即可。

相关内容

Windows11 设置全局默认sRGB颜色配置文件
365比分

Windows11 设置全局默认sRGB颜色配置文件

📅 10-04 👁️ 5530
小个子穿搭真实指南:7个显高技巧让你轻松穿出好比例
周杰伦的钢琴弹奏是什么水准? 周杰伦在音乐上的才华和造诣很高,这是他在华语乐坛地位稳固的原因之一。在钢琴演奏方面,周杰伦的水平非常高。从技术层面看,周...