想问下这个代码的 效率是不是有问题

Lucy 发布于 3个月前 分类:其他

只要是使用到了判断 条件分支,这个就执行效率好低啊,界面上图片已经显示了,可是还是没有判断下来继续执行,起码要等10秒钟才执行完,这要是多几个判断10秒钟一步的执行,这个效率太低了,是我写的有什么不对么,另外执行到另一流程快的第一个代码也是速度很慢。我这个代码有啥问题么

dim 数据 = self.input
dim 配送 = ""
dim 下载 = ""
dim 主界面 = ""
dim 更多 = ""

#icon("@res:1dh9477d-p3jh-j2di-856b-0q8vk8pm10eh.png")
主界面 = Image.Exists({"wnd":[]},{"x":9,"y":100,"width":376,"height":296},@res"1dh9477d-p3jh-j2di-856b-0q8vk8pm10eh.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true})
If 主界面=false
 

#icon("@res:c6scg7ki-np57-u5jn-8mhi-hn53ejub043g.png")
Image.Wait({"wnd":[]},{"x":0,"y":0,"width":0,"height":0},@res"c6scg7ki-np57-u5jn-8mhi-hn53ejub043g.png",0.9,"show",10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true})
#icon("@res:i64md4ja-v203-dv0p-fjsn-orqogslacace.png")
Image.Hover({"wnd":[]},{"x":592,"y":89,"width":537,"height":166},@res"i64md4ja-v203-dv0p-fjsn-orqogslacace.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate"})
#icon("@res:i26r7ofs-3knk-25rm-voev-of14c3q1il0a.png")
配送 = Image.Exists({"wnd":[]},{"x":592,"y":66,"width":587,"height":581},@res"i26r7ofs-3knk-25rm-voev-of14c3q1il0a.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true})
Do While 配送=false
#icon("@res:i64md4ja-v203-dv0p-fjsn-orqogslacace.png")
Image.Hover({"wnd":[]},{"x":592,"y":89,"width":537,"height":166},@res"i64md4ja-v203-dv0p-fjsn-orqogslacace.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":500,"iCursorOffsetY":500,"sKeyModifiers":[],"sSimulate":"simulate"})
#icon("@res:i64md4ja-v203-dv0p-fjsn-orqogslacace.png")
Image.Hover({"wnd":[]},{"x":592,"y":89,"width":537,"height":166},@res"i64md4ja-v203-dv0p-fjsn-orqogslacace.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate"})
#icon("@res:i26r7ofs-3knk-25rm-voev-of14c3q1il0a.png")
配送 = Image.Exists({"wnd":[]},{"x":592,"y":66,"width":587,"height":581},@res"i26r7ofs-3knk-25rm-voev-of14c3q1il0a.png",0.9,10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true})
 
If 配送
Break
 

End If
Loop
#icon("@res:4kt86q1r-7u3j-89p3-i3p5-ps0fpud8b5h5.png")
Image.Click({"wnd":[]},{"x":592,"y":66,"width":587,"height":581},@res"4kt86q1r-7u3j-89p3-i3p5-ps0fpud8b5h5.png",0.9,"left","click",10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate"})
#icon("@res:vbn7n20u-b7il-rjiq-r6pt-brp6bpfdqor1.png")
Image.Wait({"wnd":[]},{"x":9,"y":86,"width":319,"height":261},@res"vbn7n20u-b7il-rjiq-r6pt-brp6bpfdqor1.png",0.9,"show",10000,{"bContinueOnError":false,"iDelayAfter":50,"iDelayBefore":50,"bSetForeground":true})
End If
 
55029_E4EFJ6FU5BPDEU8

3个回复

  • enzile
    建议不要调整相似度,默认0.9就好,随意调整反而会影响识别速度与准确度
  • totoro
    如果整个流程是在网页环境下运行的,需要等待图片加载完再识别,代码没有什么问题,为了防止报错,建议在判断图像,点击图像前添加延时
  • Lucy

    为了这个找图把相似度  找图范围 延时都已经最小了 可还是很慢

联系我们

在线咨询:点击这里给我发消息

邮件:kefu@51rpa.net

工作时间:周一至周五,9:30-18:30,节假日休息