iosApp管理小结和苹果Ocr识别结果小结

135

主题

190

回帖

1152

积分

管理员

积分
1152
iosApp管理小结和苹果Ocr识别结果小结

1.png 2.png 3.png


  1. // 方法一:openApp启动
  2. app.openApp('')

  3. //方法二: appopenSelf自启动
  4. app.openSelf()

  5. // 方法三:runShortcut运行快捷指令
  6. app.runShortcut('')

  7. //方法四: openWebPage打开网页
  8. app.openWebPage('')

  9. //方法五: getMemory获取app内存占用
  10. app.getMemory()
复制代码
  1. // getAllString 获取所有识别的文本方法小结,交流QQ群711841924
  2. // 方法一:getAllString 获取所有识别的文本
  3. var ocrResult = screen.ocr(0,0,1,1);
  4. var allText = ocrResult.getAllString();


  5. // 方法二:getAllDetect 获取所有识别的目标

  6. var ocrResult = screen.ocr(0,0,1,1);
  7. var detects = ocrResult.getAllDetect(); // 获取所有识别的目标


  8. // 方法三:findText查找特定文本

  9. var ocrResult = screen.ocr(0,0,1,1);
  10. var foundDetect = ocrResult.findText("特定文本",[0, 0, 1, 1]);


  11. // 方法四:findIncludeText查找包含特定文本单目标

  12. var ocrResult = screen.ocr(0,0,1,1)
  13. var detect = ocrResult.findIncludeText("包含文本",[0, 0, 1, 1]);


  14. // 方法五:findIncludeTexts查找包含特定文本多个目标

  15. var ocrResult = screen.ocr(0,0,1,1);
  16. var detects = ocrResult.findIncludeTexts("特定文本",[0, 0, 1, 1]);


  17. // 方法六:findTextWithRegex 正则查找包含特定多个目标

  18. var detect=(ocrres.findTextWithRegex("领.*? 钻石",[0, 0, 1, 1]));
  19. if(detect == null){
  20.     printl("未找到");
  21. }else{
  22.     printl(detect[0]);
  23.     detect[0].clickRandom();
  24. }


  25. // 方法七:getJSON 获取结果的JSON字符串

  26. var ocrResult = screen.ocr(0,0,1,1);
  27. var json = ocrResult.getJSONO;//获取JSON字符串
复制代码


举报 回复