Jump to content

wont click on pixel -.-


Recommended Posts

so here the script it wont klick with left mouse on the pixel

only the script ends after some seconds without mouseklick what is wrong here?

$pixelColor = 65280

While $pixelColor = Pixelsearch(796,220,855,254,$pixelColor, 1)

If Not @error Then click()

WEnd

Func click()

Sleep(500)

$pixelColor = Pixelsearch(796,220,855,254,$pixelColor, 1)

If Not @error Then

MouseClick("Left", $pixelColor[0], $pixelColor[1])

EndIf

EndFunc

Link to comment
Share on other sites

When you use the = sign on a while line it is comparing the return value of PixelSearch() to the value of the variable $PixelColor rather than assigning $Pixelcolor to return value of PixelSearch()

Also you are overwriting $pixelcolor which would make any more PixelSeach() Lines fail.

so why not

$pixelColor = 65280

While 1
    PixelSearch(796, 220, 855, 254, $pixelColor, 1)
    If Not @error Then click()
WEnd
Func click()
    Sleep(500)
    $Pos = PixelSearch(796, 220, 855, 254, $pixelColor, 1)
    If Not @error Then
        MouseClick("Left", $Pos[0], $Pos[1])
    EndIf
EndFunc  ;==>click
Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
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...