Sign in to follow this  
Followers 0
ljkkda

wont click on pixel -.-

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

thy that help me a lot :)

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