[已解决]大漠插件找色只能找一次
本帖最后由 繁星 于 2018-6-14 23:32 编辑如下,明明是个死循环,While只循环一次就自动退出了,注释掉While里找色代码,就没问题不退出了,FindMulColor返回值0和1没找到和找到,论坛用过的前辈指点下,我看过这函数在别的语言里边循环调用都没问题,我哪里写错了?
#PRE_UseX64=n
#include <Misc.au3>
Global Const $dm = _DM()
Global $hDLL = DllOpen("user32.dll")
Do
ToolTip("右键确认绑定")
sleep(30)
Until _IsPressed("02", $hDLL)
Local $hwnd = $dm.GetMousePointWindow()
ConsoleWrite('选择的窗口句柄:' & $hwnd & @CRLF)
Local $Bind = $dm.BindWindow($hwnd, 'dx2', 'windows', 'windows', 0)
ConsoleWrite('绑定返回:' & $Bind & @CRLF)
Local $x1, $y1, $x2, $y2
$dm.GetWindowRect($hwnd, $x1, $y1, $x2, $y2)
ConsoleWrite('窗口坐标:' & $x1 &'-'& $y1 &'-'& $x2 &'-'& $y2 & @CRLF)
While 1
Local $x, $y, $fag
$fag = $dm.FindMultiColor(0, 0, $x2, $y2, 'fffecd-202020', '-3|18|fec555-202020,15|17|fee781-202020,15|-2|ffffff-202020,10|7|ffed9d-202020',1 ,0 ,$x, $y)
If $fag = 1 Then
$dm.MoveTo($x, $y)
$dm.LeftClick
EndIf
Sleep(100)
WEnd
$dm.unbindwindow()
DllClose($hDLL)
Func _DM()
Local $DM, $dm_dll = @ScriptDir & '\dm.dll'
RunWait(@ComSpec & ' /c regsvr32 /s ' & $dm_dll, '', @SW_HIDE)
$DM = ObjCreate("dm.dmsoft")
If IsObj($DM) Then
$ver = $DM.Ver()
ConsoleWrite($ver & @CRLF)
Return $DM
Else
Exit
EndIf
EndFunc ;==>RegDM
结帖,换别的了~ 感谢分享,收藏
页:
[1]