头条批量关注发消息,按键精灵自动化脚本

作者: tww844475003 分类: Python 发布时间: 2021-06-25 22:10

按键精灵自动化脚本

利用按键精灵模拟人为操作,自动批量关注头条,并送发消息

脚本代码

Dim messageStr = array("你好!","hello!","1很高兴认识你!","2很高兴认识你!","3很高兴认识你!","4很高兴认识你!","5很高兴认识你!","6很高兴认识你!","7很高兴认识你!","8很高兴认识你!","9很高兴认识你!","10很高兴认识你!","11很高兴认识你!","12很高兴认识你!","13很高兴认识你!")	//发消息内容
Dim ygzPos = 1	//定义点第几个已关注(头条号)
Dim sendTotal = 5	//定义发消息数量
Dim sendNumber = 1	//第几次发
Dim prevFSPosX = 0	//保存上次粉丝位置X
Dim prevFSPosY = 0	//保存上次粉丝位置Y
Dim screenX,screenY

screenX = GetScreenX()
screenY = GetScreenY()

Function 获取发送内容()
	Dim maxPos,randValue
	maxPos = UBOUND(messageStr)
	randValue = Int(maxPos*Rnd()+1)
	获取发送内容 = messageStr[randValue]
End Function

Sub 信息提示(内容)
    TracePrint 内容
    ShowMessage 内容
    Delay 1500
End Sub

Function 向上滑动(pos, y1)
	Delay 500
	TouchDown 100, pos, 10
	Delay 100
	TouchMove 100, pos - y1, 10
End Function

Function 验证已关注是否加载完成()
	Dim intX, intY
	FindPic 0, 0, 0, 0, "Attachment:ygz.png","000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		验证已关注是否加载完成 = true
 	Else 
 		Call 验证已关注是否加载完成()
	End If
End Function

Function 点击我的()
	Tap screenX - 100, screenY - 50	//点击“我的”
End Function

Function 后退
	Dim intX, intY
	FindPic 0, 0, 0, 0, "Attachment:goback.png","000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		Tap intX+20, intY+20
	End If	
End Function

Function 点击关注()
	Dim intX, intY
	FindPic 0, 0, 0, 0, "Attachment:gz.png","000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		Tap intX+20, intY+20
	End If
End Function

Function 点击第一个已关注()
	Dim checkYGZ = 验证已关注是否加载完成()
	If checkYGZ Then //如果加载完成就不点点击,否则重新执行
		Tap 230 * ygzPos, 230 * ygzPos
	Else 
		call 点击第一个已关注()
	End If
End Function

Function 点击粉丝()
	Dim intX, intY
	FindPic 0, 0, 0, 0, "Attachment:fs.png","000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		Tap intX+20, intY-20
	End If
End Function

Function 发消息(pos)
	Dim GZAN
	Dim startValue = 1 + sendTotal * (sendNumber-1)
	Dim endValue = sendTotal * sendNumber
	Dim intX, intY
	Dim sendContent
	
	GZAN = 查找关注按钮(prevFSPosY)
	If GZAN Then 
		prevFSPosY = GZAN
		If pos >= startValue Then 
			TracePrint "发送信息:" & pos
			//点击粉丝图片
			Tap 100, prevFSPosY
			Delay 1000
			//查询私信位置点击
			FindPic 0, 0, 0, 0, "Attachment:sx.png","000000", 0, 0.9, intX, intY
			If intX > -1 And intY > -1 Then 
 				Tap intX, intY	//点击私信
 				Delay 1000
 				Tap 80, screenY - 50
 				Delay 500
 				sendContent = 获取发送内容()
 				TracePrint "信息内容:" & sendContent
				Sys.SetClipText sendContent	//设置剪切版内容
				Call 粘贴消息()
				Delay 1000
				//点击发送
				Tap screenX - 80, screenY - 50
 				Delay 1000
 				Call 后退()
 				Delay 1000
 				Call 后退()
			End If
		Else 
			TracePrint "向上滑动不发信息!"
		End If
		Call 向上滑动(prevFSPosY, 202)
	End If
End Function

Function 粘贴消息()
	Dim intX, intY
	
	Touch 80, screenY - 50, 2000
	TouchUp 
	Delay 500
	FindPic 0, 0, 0, 0, "Attachment:zt.png","000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		Tap intX, intY
 		Delay 500
	End If
End Function

Function 查找全部粉丝
	Dim intX, intY
	FindPic 0, 0, 0, 0, "Attachment:qbfs.png", "000000", 0, 0.9, intX, intY
	If intX > -1 And intY > -1 Then 
 		查找全部粉丝 = intY
	End If
End Function

Function 查找关注按钮(y1)
	Dim intX, intY
	FindPic 0, y1, screenX, screenY, "Attachment:gz_btn.png", "000000", 0, 0.9, intX, intY
	//TracePrint "y1=" & y1
	If intX > -1 And intY > -1 Then 
		//TracePrint "intY=" & intY
 		查找关注按钮 = intY
	End If
End Function

//开始执行
Delay 1000
Call 点击我的()
Delay 1500
Call 点击关注()
Delay 1500
Call 点击第一个已关注()
Delay 1500
Call 点击粉丝()
Delay 1500
//先滑到全部粉丝
Dim QBFS
QBFS = 查找全部粉丝()
Call 向上滑动(QBFS, QBFS-92)

Dim i
For i = 1 To sendTotal * sendNumber
	Delay 1500
	Call 发消息(i)	
Next

代码涉及的图片,请翻到最底部下载附件

运行环境介绍

Window 环境,

  • 下载安装”天天模拟器”,步骤所有的直接默认.
  • 安装”头条app”,并登录
  • 安装按键精灵手机版,导入代码,运行脚本即可

天天模拟器: http://www.downza.cn/soft/194349.html

按键精灵: http://m.anjian.com/

手机环境

  • 安装”头条app”,并登录
  • 安装按键精灵手机版,导入代码,运行脚本即可

前端开发那点事
微信公众号搜索“前端开发那点事”

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注