触摸精灵lua脚本实现微信群加好友功能

--此脚本针对iPhone5/5s
--目前只实现一个屏幕微信群好友的添加,如果想添加更多好友,
--需要划屏操作,执行划屏操作时建议循环滑动 function main()
--获取屏幕的分辨率
w,h = getScreenResolution();
--输出屏幕的长、宽
notifyMessage(string.format("%d,%d\n",w,h));
mSleep(500); -- 运行微信
appRun("com.tencent.xin"); --处理第一个点击位置
local base_i = w*(1/16);
local base_j = h*(128/1136);
local add_i = w*(15/64);
local index = 0;
local bool = 1; for j = base_j,2000, h*(190/1136) do
for i = base_i,w,add_i do
--[[mSleep(500);
r,g,b = getColorRGB(i+50,j+50);--取x,y位置色
mSleep(500);
if r == 0xff and g == 0xff and b == 0xff then
bool = 0;
notifyMessage("结束条件找到");
mSleep(2000);
else
--notifyMessage("没有找到结束条件");
--mSleep(2000);
end;
]]
mSleep(1000);
touchDown(0,i+50,j+50);
mSleep(50);
touchUp(0);
mSleep(1000);
--实现全屏找图,添加到通讯录
image_x,image_y = findImage("var/mobile/Applications/add.bmp");
--mSleep(500);
if image_x ~= -1 and image_y ~= -1 then
--notifyMessage("找到图");
--添加好有
touchDown(0,image_x+5,image_y+5);
mSleep(50);
touchUp(0);
mSleep(500); touchDown(0,600,50);
mSleep(50);
touchUp(0);
--时间间隔设置稍微长点,受网络环境影响
mSleep(2000); --发送添加好友成功后返回,不用找图或找色,直接单击返回按钮的点效率比较高
touchDown(0,20,80);
mSleep(50);
touchUp(0);
--如果没有找到添加通讯图图,则全屏查找发消息
else
--
mSleep(1000);
message_x,message_y = findImage("var/mobile/Applications/message.bmp");
mSleep(50);
if message_x ~= -1 and message_y ~= -1 then
--notifyMessage("找到图");
mSleep(50);
--notifyMessage("如果是消息直接返回");
--发送添加好友成功后返回
touchDown(0,20,80);
mSleep(50);
touchUp(0);
--添加通讯录和发消息都没有找到则提示一下信息
else
mSleep(500);
notifyMessage("既没有添加通讯录也没有发送消息");
end;
end; --[[
--全屏模糊找色,寻找添加通讯录按钮
x,y = findColorFuzzy(0x00B92F,90);
if x ~= -1 and y ~= -1 then
touchDown(3,x,y);
mSleep(500);
touchUp(3);
else
notifyMessage("没有找到");
mSleep(2000);
end
mSleep(2000); --添加好友验证消息并寻找发送按钮
send_x,send_y = findColorFuzzy(0x00B92F,85);
if send_x ~= -1 and send_y ~= -1 then
touchDown(4,send_x,send_y);
mSleep(500);
touchUp(4);
end
mSleep(2000); x_back,y_back = findColorInRegionFuzzy(0xffffff,95,20,60,80,200);
if x_back ~= -1 and y_back ~= -1 then
touchDown(2,x_back,y_back);
mSleep(200);
touchUp(2);
--mSleep(100);
end
]]
mSleep(50);
end
base_j = base_j+h*(190/1136);
mSleep(200);
end
-- end

  

上一篇:Android ListView 中加入CheckBox/RadioButton 选择状态保持、全选、反选实现


下一篇:在vue中使用svg sprite