本帖最后由 hoibo 于 2023-8-14 20:14 编辑
require "import"
import "android.widget.*"
import "com.androlua.*"
import "android.graphics.Rect"
local p=Rect()
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{
EditText,
id="edit",
hint="点击的关键字",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
EditText,
id="edit2",
hint="点击次数",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
InputType="number"
},
{
EditText,
text="10",
id="edit3",
hint="时间(以毫秒为单位)",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
InputType="number"
},
{
Button,
text="极速连续点击",
onClick="jsdj",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="自定义连续点击",
onClick="zdydj",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
{Button,
text="关键字连续点击",
onClick="gjzdj",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
}
dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function jsdj()
dlg.hide()
if edit2.text==""
print("请输入点击次数")
else
node.getBoundsInScreen(p)
service.click({{"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2))..","..edit2.text..","..edit3.text.."]"}})
end
end
function gjzdj()
dlg.hide()
if edit.text==""
print("请输入点击关键字")
else
task(500,function()
service.click({{"*"..edit.text.."*<"..edit2.text.."$"..edit3.text}})
end)
end
end
function zdydj()
dlg.hide()
if edit2.text==""
print("请输入点击次数")
else
node.getBoundsInScreen(p)
service.click({{"["..string.format("%.0f,%.0f",(p.left+(p.right-p.left)/2),(p.top+(p.bottom-p.top)/2)).."]<"..edit2.text.."$"..edit3.text}})
end
end |