if service.isShowInputWindow() then
service.click({{"发送|确定|保存|完成|评论|搜索"}})
elseif node.isEditable()
service.execute("粘贴",node)
elseif service.click({{"[接听]"},
{"[挂断&扬声器*]"},
{"挂断电话"}})
elseif service.check("微信",node) or service.check("*头像",node) or service.check("*群昵称",node) or service.check("*资料卡",node)
if service.execute("操作",node)
return true
else
return service.execute("模拟双击",node)
end
elseif service.isSeekBar(node)
service.click({{"%主菜单$50",
"进度>10$50",
}})
else
require "import"
import "android.net.Uri"
import "android.content.Intent"
text=service.getText(node)
ret={}
function append(t,v)
if not table.find(t,v) then
table.insert(t,v)
end
end
for n in text:gmatch("%d%d%d%d%d+") do
table.insert(ret,n)
end
for url in text:gmatch("https?://[%w%%%=#/%?%._%-%+&]+") do
append(ret,url)
end
for url in text:gmatch("[%w%._%-:/]+%.cn[%w%%%=#/%?%._%-%+&]*") do
append(ret,url)
end
for url in text:gmatch("[%w%._%-:/]+%.com[%w%%%=#/%?%._%-%+&]*") do
append(ret,url)
end
for url in text:gmatch("[%w%._%-:/]+%.org[%w%%%=#/%?%._%-%+&]*") do
append(ret,url)
end
for url in text:gmatch("[%w%._%-:/]+%.net[%w%%%=#/%?%._%-%+&]*") do
append(ret,url)
end
if #ret==0 then
service.execute("播放暂停")
return true
end
dlg=LuaDialog(service)
dlg.setTitle(string.format("共%d条",#ret))
dlg.setItems(String(ret))
dlg.setButton("点击链接",function()
service.execute("链接",node)
end)
dlg.show()
dlg.onItemClick=function(l,v,p,i)
dlg.dismiss()
if v.text:find("http")
service.startActivity(Intent(Intent.ACTION_VIEW,Uri.parse(v.text)).setFlags(0x10000000))
return true
elseif v.text:find("%d%d%d%d%d")
service.callPhone(v.text)
else
return service.execute("链接",node)
end
end
dlg.onItemLongClick=function(l,v,p,i)
dlg.dismiss()
service.copy(v.text)
require "import"
local t1={"qq加好友/群","微信加好友"}
local t2={
{{">qq",
"?%返回&表情$50",
"快捷入口>50$50",
"加好友/群>50$500",
"搜索,搜索栏$500",
"%粘贴",
"网络查找*>5"}},
{{">微信",
"?%返回&!通讯录$50",
"更多功能按钮>50$50",
"添加朋友>50$50",
"com.tencent.mm:id/j69",
"%粘贴",
"[搜索*]"}}
}
local dlg=LuaDialog()
.setItems(t1)
.show()
dlg.onItemClick=function(l,v,p,i)
dlg.dismiss()
service.click(t2)
end
end
end
return true
来自解说社区客户端 |