Jump to content

Pixelsearch script whats wrong?


Recommended Posts

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Windows 7
; Author:         Casper
;
; Script Function:
;   Mouseclick when a single pixel on screen change to the Select color



; Prompt the user to run the script - use a Yes/No prompt
$answer = MsgBox(4, "AutoIt", "Run?")

; Find a white pixel in the range 577,569-577,569
If $coord = PixelSearch( 577, 569, 577, 569, 0xFFFFDE ) Then
    sleep(200)
    Mouseclick("Left" [, 700, 800[, 2]])
EndIf

I want my script to search for a single pixel to change color, Just stay searching for the pixel untill the pixel change color then click with the mouse 1-2 times. After the mouse click i want it to loop/start the scrips again untill i stop it.

I am very new here and have workd on this in 5hours now without getting any closer.

can some1 plzz tell me what more to add and maybe help me if my scrips not sceems to work.

Link to comment
Share on other sites

Try...

; Prompt the user to run the script - use a Yes/No prompt
$Answer = MsgBox(4, "AutoIt", "Run?")
If $Answer = 6 Then
    PixelS()
Else
    Exit
EndIf

Func PixelS()
    While 1
        Sleep(200)
        ; Find a white pixel in the range 577,569-577,569
        $PixelSeek = PixelSearch(577, 569, 577, 569, 0xFFFFDE)
        If Not @error Then
            MouseClick("Left", $PixelSeek[0], $PixelSeek[1], 2)
        EndIf
    WEnd
EndFunc   ;==>PixelS
[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

Thanks lordicast yes thats what i looking for..

If i can ask for a one little thing.

Is this possible to search for pixel two different places on same time: Only mouseclick if two different pixel, two different places on the screen have the same color? if i got the cordinate of both of the pixels

example: i need the mouse to click if pixel on cord 577, 575 is 0xFFFFFF (white) and pixel in cord 880, 980 is 0xFFFFFF (white)

when both pixel are white (and only when they are white same time) mouse click. it dont have to click where the pixel is just click where i manuel put the mouse.

Link to comment
Share on other sites

; Prompt the user to run the script - use a Yes/No prompt
$Answer = MsgBox(4, "AutoIt", "Run?")
If $Answer = 6 Then
    PixelS()
Else
    Exit
EndIf

Func PixelS()

    While 1
        Sleep(200)
        $Pix1 = PixelGetColor(577, 575)
        $Pix2 = PixelGetColor(880, 890)

        If Hex($Pix1) = '00FFFFFF' Then
            If Hex($Pix2) = '00FFFFFF' Then
                MouseClick("Left")
            EndIf
        EndIf
    WEnd
EndFunc   ;==>PixelS

[Cheeky]Comment[/Cheeky]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...