| function 判断前台(包名)
 local pkg = 包名
 local ret = appIsFront(pkg)
 if ret == false then
 调试("包名不在前台")
 return true
 else
 调试("在前台")
 return false
 end
 end
 function 随机数(最大数,最小数)
 local r = rnd(最大数,最小数)
 end
 function 输入文字(内容)
 inputText(内容,true)
 setIme(false) --切换系统默认输入法
 end
 function 划动(x1,y1,x2,y2,s)
 swipe(x1,y1,x2,y2,s)
 end
 
 function 调试(内容)
 print(内容)
 end
 function 调试坐标(x,y)
 print(x,y)
 end
 
 function 显示(文字)
 toast(文字,0,0,12)
 end
 function 点击(x,y)
 tap(x,y)
 显示("点:",x,y)
 end
 function 找色(v,s)
 a=1
 x,y = findMultiColor (v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8])
 if x>-1 and y >-1 then
 if s==a then
 点击(x,y)
 调试坐标(x,y)
 return x,y
 else
 调试坐标(x,y)
 return x,y
 end
 else
 return false
 end
 end
 function 比色(v)
 ret = cmpColorEx(v[1],v[2])
 if ret==1 then
 return true
 else
 return false
 end
 end
 
 function 找节点点击(v)
 local ret = nodeLib.findOne(v[2],v[3])
 if ret ~= nil then
 nodeLib.click(ret)
 return true
 else
 return false
 end
 end
 function 找节点(v)
 local ret = nodeLib.findOne(v[2],v[3])
 if ret ~= nil then
 return true
 else
 return false
 end
 end
 function 顺序找节点(v)
 local ret = nodeLib.findByIndex(v[1])
 if ret ~= nil then
 return true
 else
 return false
 end
 end
 function 顺序找节点点击(v)
 local ret = nodeLib.findByIndex(v[1])
 if ret ~= nil then
 nodeLib.click(ret)
 return true
 else
 return false
 end
 end
 function 屏幕分辨率(w,h)
 w,h = getDisplaySize()
 print(w,h)
 
 end
 function 找坐标(x1,y1,x2,y2)
 
 local r = ocrEx(x1,y1,x2,y2)
 local a,z = "41","66"
 if r ~= nil then
 local 坐标 = r[1].text
 local 查找逗号 = string.find(坐标, ":", 1)
 if 查找逗号 ~= nil then
 local 分割坐标 = splitStr(坐标,":")
 y =分割坐标[2]
 x =分割坐标[1]
 print(x)
 print(y)
 if x == a and y == z then
 print("找到")
 return true
 else
 print("没有找到")
 return false
 end
 end
 end
 end
 function 识别点击(x1,y1,x2,y2,x3,y3,文字)
 
 识别=ocrEx(x1,y1,x2,y2)
 
 if 识别==int then
 return false
 else
 print(识别[1].text)
 if 识别[1].text==文字 then
 调试("找到")
 点击(x3,y3)
 return true
 else
 
 调试("没有找到")
 return false
 end
 
 end
 
 
 end
 function 识别点击(x1,y1,x2,y2,文字)
 
 识别=ocrEx(x1,y1,x2,y2)
 
 if 识别==int then
 return false
 else
 print(识别[1].text)
 if 识别[1].text==文字 then
 调试("找到")
 
 return true
 else
 
 调试("没有找到")
 return false
 end
 
 end
 
 
 end
 
 |