ofLight Posted November 9, 2006 Share Posted November 9, 2006 Can anyone help me to Understand why this isnt working? I am trying to get it to Search for the image then bring up the progress bar that sais it will try again if it fails to find it, then Search again. But it seems to only be searching the first time, then getting stuck in a Loop of progress bars. expandcollapse popup#include <GUIConstants.au3> ; Progress Specific #include "array.au3" global $AZDLLName = "analizer.dll" _SearchLoop() Func _SearchLoop() AZPrintWindow() $var = _findImageOnScreen("SciteSym.bmp", "0,0,0,0", 1) If $var <> 0 Then For $r = 1 to UBound($var)-1 MouseMove($var[$r][1] , $var[$r][2], 20 ) MsgBox(4096, 'Found it', 'test', 0) Sleep(200) Next EndIf If $var = @error Then $Form1 = GUICreate("Problem FInding Image, Trying again in 5sec", 306, 20, 200, 165, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS)) $Progress1 = GUICtrlCreateProgress(8, 0, 289, 17) For $i = 1 to 100 step 1 sleep(25) ; wait time. GUICtrlSetData($progress1, $i) GUISetState(@SW_SHOW) next GUICtrlSetData($progress1, 100) sleep(250) GUIDelete($Form1) SetError(0) $var = 0 _SLReEnter() EndIf EndFunc Func _SLReEnter() ;MsgBox(4096, "Didnt find it", "crap", 0) Sleep(500) _SearchLoop() EndFunc ;Find image on screen and return cords ;findFile: File you want to find on the screen ;rect: x,y,width,height ;first: 1 = find first 0 = find all Func _findImageOnScreen($findFile, $rect, $first) Dim $mouseCords[1][3] $rects = "" $trans = 0 $color = "" $result = DllCall($AZDLLName, "int", "image_in_clipscreen_rects", "str", $findFile, "int", $first, "int", $trans, "str", $color, "str", $rect, "str", $rects) AZDllError("AZTextRects") $rects = $result[6] ;MsgBox(0,"",$rects) if $rects <> "" then $rects = stringright($rects, stringlen($rects) - 1) $rects = stringsplit($rects, ";") $mouseIndex = $rects[0] ReDim $mouseCords[$mouseIndex+1][3] else $rects = _arraycreate(0) endif if $rects[0] < 1 then return 0 endif if ($rects[0] <> 0) then For $n = 1 to $mouseIndex ;MsgBox(0,$n,$rects[$n]) $items = stringsplit($rects[$n], ",") if $items[0] = 4 then $mouseCords[$n][1] = $items[1] + $items[3] / 2 $mouseCords[$n][2] = $items[2] + $items[4] / 2 $pWidth = $items[3] $pHeight = $items[4] ElseIf $items[0] = 3 then $mouseCords[$n][1] = $items[1] + $pWidth / 2 $mouseCords[$n][2] = $items[2] + $pHeight / 2 Else AZTraceError("Index of the needed text rect out of bounds.") AZExit() Endif ;MsgBox(0,$mouseCords[$n][1],$mouseCords[$n][2]) Next else $items = _arraycreate(0) endif return $mouseCords EndFunc ;------------------------------- func AZPrintWindow() ; Print window to clipboard (don't ALT PRINTSCREEN) $result = DllCall($AZDLLName, "none", "active_window_to_clip") AZDllError("AZPrintWindow") endfunc func AZDllError($func) ;Error if @error <> 0 then AZTraceError("'" & $func & "' function run error") endfunc func AZTraceError($error) ; Tracing error MsgBox(16, "Analizer error.", $error) endfunc There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now