好友
阅读权限20
听众
最后登录1970-1-1
|
本帖最后由 lisaisacat 于 2020-12-9 10:13 编辑
运行环境:LuaBox/积木编程(软件自行百度下载,关键词:触动精灵官网)
运行系统:安卓 5 以上,无需 ROOT
2020-10-27 更新:
简化代码、增加可视化源码
代码逻辑:
新版源码:
[Lua] 纯文本查看 复制代码 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | pkgname = app.getPackageName( "支付宝" )
app.runApp(pkgname)
mSleep( 3000 )
for i = 1 , 5 do
local text = "签到"
local check = widget.find({[ "text" ]= "签到" })
if check ~= nil then
x,y,x1,y1 = widget.region(check)
if x ~= - 1 then
toast(text)
event.tap(x,y)
mSleep( 3000 )
end
else
local text = "领积分"
local collect = widget.find({[ "text" ]= "领积分" ,[ "type" ]= "View" })
if collect ~= nil then
x1,y1,x2,y2 = widget.region(collect)
x = (x1+x2)/ 2
y = (y1+y2)/ 2
toast(text)
event.tap(x,y)
mSleep( 3000 )
else
local text = "积分待领取"
local point = widget.find({[ "text" ]=text,[ "rule" ]= 3 })
if point ~= nil then
x1,y1,x2,y2 = widget.region(point)
if x1 ~= - 1 then
toast(text)
event.tap(x1,y1)
mSleep( 3000 )
end
else
local text = "我的"
local my = widget.find({[ "id" ]= "com.alipay.android.phone.wealth.home:id/tab_description" ,[ "text" ]= text})
if my ~= nil then
x,y,x1,y1 = widget.region(my)
if x ~= - 1 then
toast(text)
event.tap(x,y)
mSleep( 3000 )
end
end
end
end
end
end
|

使用方法:复制代码 - 打开软件 - 新建脚本 - 粘贴代码 - 运行
开发环境:触动精灵编辑器 3.0
脚本功能:自动打开支付宝>>打开我的界面>>领取积分
脚本语言:Lua
脚本原理:
仍然是使用安卓系统的无障碍权限查找界面控件的 text 和 desc 属性
脚本源码:
[Lua] 纯文本查看 复制代码 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | pkgname = app.getPackageName( "支付宝" )
app.runApp(pkgname)
mSleep( 3000 )
local text = "我的"
local my = widget.find({[ "id" ]= "com.alipay.android.phone.wealth.home:id/tab_description" ,[ "text" ]= text})
if my ~= nil then
x,y,x1,y1 = widget.region(my)
if x ~= - 1 then
toast(text)
event.tap(x,y)
mSleep( 3000 )
end
end
local text = "积分待领取"
local point = widget.find({[ "text" ]=text,[ "rule" ]= 3 })
if point ~= nil then
x1,y1,x2,y2 = widget.region(point)
if x1 ~= - 1 then
toast(text)
event.tap(x1,y1)
mSleep( 3000 )
end
end
local text = "领积分"
local collect = widget.find({[ "text" ]= "领积分" })
if collect ~= nil then
x,y,x1,y1 = widget.region(collect)
if x ~= - 1 then
toast(text)
event.tap(x,y)
mSleep( 3000 )
end
end
local text = "签到"
local check = widget.find({[ "text" ]= "签到" ,[ "path" ]= "/FrameLayout/LinearLayout/FrameLayout/FrameLayout/RelativeLayout/RelativeLayout/RelativeLayout/RelativeLayout/FrameLayout/WebView/ba/WebView/View/View/View/View/View/View/View" })
if check ~= nil then
x,y,x1,y1 = widget.region(check)
if x ~= - 1 then
toast(text)
event.tap(x,y)
mSleep( 3000 )
end
end
|
|
免费评分
-
查看全部评分
|