本帖最后由 hoibo 于 2023-9-8 21:40 编辑
require "import"
import "com.androlua.Ticker"
import "android.widget.*"
import "android.view.*"
import "android.graphics.Rect"
local p=Rect()
if ti then
ti.stop()
service.speak("停止")
ti=nil
return true
end
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{
EditText,
hint="输入关键字",
HintTextColor='#ffffff00',
Gravity="center_horizontal",
id="e1",
textColor="#ffffff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
EditText,
hint="次数",
HintTextColor='#ffffff00',
Gravity="center_horizontal",
id="e2",
textColor="#ffffff00",
layout_width=-1,
layout_height="10%h",
inputType="number",
layout_weight=1,
},
{
EditText,
text="1000",
hint="次数的间隔时间(以毫秒为单位)",
HintTextColor='#ffffff00',
id="e3",
Gravity="center_horizontal",
textColor="#ffffff00",
layout_width=-1,
layout_height="10%h",
inputType="number",
layout_weight=1,
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="自动点击",
onClick="zddj",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制自动点击代码",
onClick="fzzddjdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="无限循环,再次启动插件停止",
onClick="wxxh",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制无限循环代码",
onClick="fzwxxhdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="开始次数循环",
onClick="csxh",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制次数循环代码",
onClick="fzcsxhdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="极速连续点击",
onClick="jslxdj",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制极速连续点击代码",
onClick="fzjslxdjdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="自定义连续点击",
onClick="zdylxdj",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制自定义连续点击代码",
onClick="fzzdylxdjdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{Button,
text="关键字连续点击",
onClick="gjzlxdj",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
{Button,
text="复制关键字连续点击代码",
onClick="fzgjzlxdjdm",
textColor="#ffffff00",
layout_width=-1,
layout_weight=1,},
},
}
dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function wxxh()
if e1.text==""
print("请输入关键字")
else
dlg.hide()
ti=Ticker()
ti.Period=tonumber(e3.text)
ti.onTick=function()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,s)
end
if #t>0
service.click({t})
end
end
ti.start()
service.speak("开始")
end
end
function csxh()
if e2.text==""
print("请输入循环次数")
else
dlg.hide()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,s)
end
点击列表=t
按钮列表={}
function append(t1,t2)
for k,v in ipairs(t2) do
table.insert(t1,v)
end
end
for n=1,tonumber(e2.text) do
append(按钮列表,点击列表)
end
task(500,function()
if service.click({按钮列表}) then
return true
end
end)
end
end
function fzcsxhdm()
if e1.text=="" or e2.text==""
print("请输入关键字和次数")
else
dlg.hide()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,"\""..s.."\",")
end
service.copy("点击列表={{{"..table.concat(t).."}}}\n按钮列表={}\nfunction append(t1,t2)\nfor k,v in ipairs(t2) do\ntable.insert(t1,v)\nend\nend\nfor n=1,"..tonumber(e2.text).." do\nappend(按钮列表,点击列表)\nend\nif service.click({按钮列表})\nreturn true\nend")
end
end
function fzwxxhdm()
if e1.text==""
print("请输入关键字")
else
dlg.hide()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,"\""..s.."\",")
end
service.copy("require \"import\"\nimport \"com.androlua.Ticker\"\nif ti then\nti.stop()\n service.speak(\"停止\")\n ti=nil\n return true\nend\nti=Ticker()\nti.Period="..tonumber(e3.text).."\nti.onTick=function()\nservice.click({{"..table.concat(t).."}})\nend\nti.start()\nservice.speak(\"开始\")\nreturn true")
end
end
function jslxdj()
if e2.text==""
print("请输入点击次数")
else
dlg.hide()
node.getBoundsInScreen(p)
service.click({{"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2))..","..e2.text..",".."10]"}})
end
end
function gjzlxdj()
if e1.text==""
print("请输入点击关键字")
else
dlg.hide()
task(500,function()
service.click({{"*"..e1.text.."*<"..e2.text.."$"..e3.text}})
end)
end
end
function zdylxdj()
if e2.text==""
print("请输入点击次数")
else
dlg.hide()
node.getBoundsInScreen(p)
service.click({{"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2)).."]<"..e2.text.."$"..e3.text}})
end
end
function zddj()
if e1.text==""
print("请输入关键字")
else
dlg.hide()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,s)
end
task(500,function()
service.click({t})
end)
end
end
function fzzddjdm()
if e1.text==""
print("请输入关键字")
else
dlg.hide()
local t,str={},e1.text or ""
for s in str:gmatch"[^\n]+"
table.insert(t,"\""..s.."\",")
end
service.copy("service.click({{"..table.concat(t).."}})\nreturn true")
end
end
function fzjslxdjdm()
if e2.text==""
print("请输入点击次数")
else
dlg.hide()
node.getBoundsInScreen(p)
service.copy("require\"import\"\nimport \"android.graphics.Rect\"\nlocal p=Rect()\nnode.getBoundsInScreen(p)\nservice.click({{\"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2))..","..e2.text..",".."10]\"}})\nreturn true")
end
end
function fzzdylxdjdm()
if e2.text==""
print("请输入次数")
else
dlg.hide()
node.getBoundsInScreen(p)
service.copy("require \"import\"\nimport \"android.graphics.Rect\"\nlocal p=Rect()\nnode.getBoundsInScreen(p)\nservice.click({{\"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2)).."]<"..e2.text.."$"..e3.text.."}})\nreturn true")
end
end
function fzgjzlxdjdm()
if e1.text=="" or e2.text==""
print("请输入关键字和次数")
else
dlg.hide()
service.copy("service.click({{\"*"..e1.text.."*<"..e2.text.."$"..e3.text.."\"}})\nreturn true")
end
end |