2017-04-24 16 views
2

Sikulisikuli如何在同一時間

我需要檢查是否存在我要點擊圖像,圖像的特定區域會出現隨機,我寫的代碼檢查但檢查多個圖像,它需要10秒鐘來檢查該地區,無論如何我可以縮短時間。

Settings.MinSimilarity = 0.95 
Reg = Region(582,404,214,187) 
img = capture(Reg) 
search = True 
Settings.MoveMouseDelay = 0 
while search : 
    if Reg.exists("12.png") or Reg.exists("13.png") or Reg.exists("14.png")or Reg.exists("15.png")or Reg.exists("28.png"): 
     click(Reg.getLastMatch()) 
     search = False 
+0

看看這裏:http://eugenesautomation.blogspot.com.au/2015/01/optimizing-pattern-matching-using-sikuli_21.html –

回答

0

您可以將0參數添加到exists()電話。

所以不是

if Reg.exists("12.png") or Reg.exists("13.png") or Reg.exists("14.png")or Reg.exists("15.png")or Reg.exists("28.png"): 

你必須:

if Reg.exists("12.png",0) or Reg.exists("13.png",0) or Reg.exists("14.png",0)or Reg.exists("15.png",0)or Reg.exists("28.png",0): 

this,零參數意味着

0作爲第二個參數存在的力量,那隻執行一次搜索並立即返回結果。它不會等待標準的3秒,所以它非常靈敏。

該區域越小,速度越快。