Skrip Posted November 3, 2006 Share Posted November 3, 2006 Sleep(2000) HotKeySet("h", "stop") $searchcolor = 0xFFFFFF While 1 $coord = PixelSearch(393, 599, 869, 917, $searchcolor, 10, 3) ;~ $coord2 = PixelSearch(623, 747, 642, 764, $searchcolor, 1) If IsArray($coord) = 1 Then MouseMove($coord[0], $coord[1], 0) EndIf ;~ If IsArray($coord2) = 1 Then ;~ MouseClick("left", $coord2[0], $coord2[1]) ;~ EndIf WEnd Func stop() Exit EndFunc [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
AutoChris Posted November 3, 2006 Share Posted November 3, 2006 Sleep(2000) HotKeySet("h", "stop") $searchcolor = 0xFFFFFF While 1 $coord = PixelSearch(393, 599, 869, 917, $searchcolor, 10, 3) ;~ $coord2 = PixelSearch(623, 747, 642, 764, $searchcolor, 1) If IsArray($coord) = 1 Then MouseMove($coord[0], $coord[1], 0) EndIf ;~ If IsArray($coord2) = 1 Then ;~ MouseClick("left", $coord2[0], $coord2[1]) ;~ EndIf WEnd Func stop() Exit EndFunc1. Get a faster computer. 2. Search a smaller area. 3. Don't do any error checking. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 1. Get a faster computer.2. Search a smaller area.3. Don't do any error checking.You forgot:4. IsArray() is being returned as a boolean, so you don't need = 1, just something extra to make it do.5. Use a different language. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
tresa Posted November 4, 2006 Share Posted November 4, 2006 (edited) try something like this if you're looking for an object which is moving on the screen expandcollapse popupSleep(2000) HotKeySet("h", "stop") $searchcolor = 0xFFFFFF dim $l,$t,$r,$b $lmin=393 $tmin=599 $rmax=869 $bmax=917 clipRect(0) While 1 $coord = PixelSearch($l, $t, $r, $b, $searchcolor, 10, 3) if @error=1 Then clipRect(0) Else MouseMove($coord[0], $coord[1], 0) clipRect(20) EndIf WEnd Func clipRect($rectSize) if $rectSize=0 then $l=$lmin $t=$tmin $r=$rmax $b=$bmax else $l=$coord[0]-$rectSize/2 if $l<$lmin then $l=$lmin $t=$coord[1]-$rectSize/2 if $t<$tmin then $t=$tmin $r=$l+$rectSize if $r>$rmax then $r=$rmax $l=$r-$rectSize endif $b=$t+$rectSize if $b>$bmax then $b=$bmax $t=$b-$rectSize endif endif EndFunc Func stop() Exit EndFunc Edited November 4, 2006 by tresa 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