獲取

2016-12-31 64 views
1

我使用PixelSearch功能的所有像素的位置,我知道如何找到1個像素符合我的標準的,但問題是,我想找到所有像素的具體顏色,這增加array,所以我可以用它來rand之一,然後點擊它。獲取

的源代碼:

Local $aCoord = PixelSearch(0, 0, $clientSize[0], $clientSize[1], 0x09126C, 10, 1, $hWnd) 
If Not @error Then 
    ; add to array and search next 
Else 
    GUICtrlSetData($someLabel, "Not Found") 
EndIf 

我想找到所有像素,沒有一個 「第一」。我怎樣才能做到這一點?我錯過了什麼嗎?

+0

請提供您擁有的代碼。也許在密鑰上匹配的代碼? –

+0

我不知道,「自動,像素搜索,找到所有像素,而不是1」是難以理解,但okey我會嘗試更準確地解釋它... – ulou

+0

我認爲任何普通的Autoit解決方案可能會相當緩慢 – Richard

回答

3

不能使用PixelSearch完成,因爲它找到匹配的像素時停止執行。

它可以通過在您所在地區循環使用PixelGetColor來完成。喜歡的東西:

For $x = 0 To $clientSize[0] Step 1 
    For $y = 0 To $clientSize[1] Step 1 
     If PixelGetColor($x,$y,$hWnd) = 0x09126C Then 
     ;Add $x and $y to Array using _ArrayAdd() (or whatever you prefer) 
     EndIf 
    Next 
Next 

這可能會覺得速度慢於PixelSearch,因爲它現在擁有掃描,而不是在第一場比賽停止整個區域,但它不應該是,因爲PixelSearch是基於同樣的原則。

+0

使用它可以更快地實現某些功能:https://www.autoitscript.com/forum/topic/126430-advanced-pixel-search-library/ – Richard