本帖最后由 dearmb 于 2014-3-10 16:22 编辑 #AutoIt3Wrapper_UseX64=n
#Include <ScreenCapture.au3>
#include <array.au3>
#Include <File.au3>
#Include <Date.au3>
;Opt("MouseCoordMode", 0)
Global $x1,$x2,$y1,$y2,$flag=0,$flag1=0,$flag2=0,$flag3=0,$k,$a=1,$arrhenggang[0],$aaa,$i, $vC, $iMix, $vNeed
$dm = ObjCreate("dm.dmsoft")
WinActivate ("BlueStacks")
Sleep(1000)
$size = WinGetPos("BlueStacks")
$x1=$size[0]
$y1=$size[1]
$x2=$size[0]+$size[2]
$y2=$size[1]+$size[3]
$liangdian = $dm.FindPicEx($x1,$y1,$x2,$y2,@ScriptDir & '\Image\liangdian.bmp',"000000",0.9,2)
$ssliangdian=StringSplit($liangdian,"|")
$countliangdian=$ssliangdian[0];两点的个数
For $i = $countliangdian to 1 Step -1;
ReDim $arrhenggang[0]
$henggang = $dm.FindPicEx($x1,$y1,$x2,$y2,@ScriptDir & '\Image\henggang.bmp',"000000",0.9,2)
$sshenggang=StringSplit($henggang,"|")
$counthenggang=$sshenggang[0]
For $k=1 To $counthenggang
$ssshenggang=StringSplit($sshenggang[$k],",")
_ArrayAdd($arrhenggang, $ssshenggang[3])
Next
$liangdian = $dm.FindPicEx($x1,$y1,$x2,$y2,@ScriptDir & '\Image\liangdian.bmp',"000000",0.9,2)
$ssliangdian=StringSplit($liangdian,"|")
$sssliangdian=StringSplit($ssliangdian[$i],",")
$vCZ=$sssliangdian[3]
_ArrayDisplay($arrhenggang, "原数组")
;MsgBox(0,0,$vCZ)
For $j = 0 To UBound($arrhenggang) - 1
; MsgBox(0,0, $arrhenggang[$j])
$vC = $arrhenggang[$j] - $vCZ
; MsgBox(0,0,$vC)
If $vC > 0 And (Not $iMix Or $vC < $iMix) Then
Dim $vNeed = $arrhenggang[$j], $iMix = $vC
EndIf
Next
MsgBox(0, '最接近' & $vCZ, $vNeed)
If $vNeed="" Then MsgBox(0,0,0)
Next
下一楼是图片
用四个数分别做对比,744,581,427,178(就是点赞那两个点的Y坐标)
对比的数组是三个数,201,450,637就是找到了条横杠的Y坐标
最后的178,找到最近的数应该是201,但是返回的是450
不知道为什么 |