Sign in to follow this  
Followers 0
Reznor

Pixel Found, now what?

7 posts in this topic

I never got a chance to work with anything like AutoIt. Thanks. :)

So, let's say I want to do something with red pixels.

First thing is finding it, "then" what?

$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then

I want to MouseMove ("0xFF0000") or something like mouseclick ("left" 0xFF0000)

I have a feeling im about to learn very important code for autoit that every user shoud know

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Makes sense. Thanks :]

Here is script, simpler than anything else i would have tried.

$i = 0
While $i <= 18
    $i = $i + 1

$coord = PixelSearch( 0, 108, 308, 265, 0xFFFFFF )
If Not @error Then
  MouseClick( "left", $coord[0], $coord[1] )
    sleep ("20000")
EndIf
    
WEnd
Edited by Reznor

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I wish to look for the 1st pixel, but if no array is found,

look for the 2nd pixel , if no array is found

then for security, look for a 3rd pixel color but for example Mouseclick ("Left" 186, 122) if niether of the three pixels were found.

i was using autoit2 basic commands over night but mabey if someone can show this particular script awnser ill understand how the "If, else, while, wend, end if" ect, work especialy when there are several. . I tried a lot of forum search which helped on other things

(I am really sorry i clicked "reply" not edit, hence double post)

Edited by Reznor

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

(thanks)

could i see an actual script something like this? (I know this language is wrong, but I need to learn the correct language)

while;(loop start)
      Searchpixel (in # # # # rectangle, for ######## color)
If found - 
      click the array 
     And endif
if not found
       Searchpixel (in # # # # rectangle, for ######## color)
If found
        click the array
        and endif
if not found
        send ("{Right 10}")
        and endif
Wend

If I saw this basic script I would learn a lot about the language. It would probably enhance every function I already know.

Edited by Reznor

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

While 1;(loop start)
  ;Loop 3 times and exit the inner loop when a pixel color is found
   For $i = 1 To 3
    ;Searchpixel (in # # # # rectangle, for ######## color)
      If $i = 1 Then
         $coord = PixelSearch(0, 0, 20, 300, 0xFF0000)
      ElseIf $i = 2 Then
         $coord = PixelSearch(0, 0, 20, 300, 0x00FF00)
      ElseIf $i = 3 Then
         $coord = PixelSearch(0, 0, 20, 300, 0x0000FF)
      EndIf
      If NOT @error Then
    ;If found Then
        ;click the array 
         MouseClick("left", $coord[0], $coord[1], 1, 1)
         $Matched = 1
         ExitLoop
      Else
         $Matched = 0
      EndIf
   Next
   If NOT $Matched Then Send ("{Right 10}")
Wend

Edited by SlimShady

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks that worked out and i understand a bit more about the language..

(Other question moved here)

If threads are deleted or moved this onehas potential :)

Edited by Reznor

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0