Sign in to follow this  
Followers 0
lilandywandy

Help plz ^^

8 posts in this topic

I understand something like this:

If PixelGetColor(119,780) = Dec("94929c") Then
      Send("{F7}")
      Sleep(2000)

does a specific action when a pixel equals a specific color

But lets say the color for my program is k0k0k0

how can i make it so that my comp just clicks on k0k0k0 when it is present? (the coords are uncertain, it just clicks when ever k0k0k0 is somewhere on screen)

Share this post


Link to post
Share on other sites



hotkeySet("{ESC}", "quit")
func quit()
    exit
endFunc

local $rgb = 0xc0c0c0
local $xy

while (1)

    $xy = pixelSearch(0, 0, @desktopWidth, @desktopHeight, $rgb)

   ; if colour is found
    if not(@error) then
        mouseClick("primary", $xy[0], $xy[1])
       ; wait until colour is gone from that spot
        while (pixelGetColor($xy[0], $xy[1] = $rgb)
            sleep(100)
        wEnd
    else
        sleep(1000)
    endIf

wEnd

Share this post


Link to post
Share on other sites

mouseClick("primary", $xy[0], $xy[1]) sorry im a beginning, which part do i add "right" for right click?

i tested it, it seems to work great, but i havnt run into the error part

i was wondering, what happens if that colors not present? does it just sleep till it is?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Simply replace primary with either secondary or right.

If the colour's not present then it waits for a full second before checking again. When the colour is present, the script clicks the mouse at that point, waits until the colour is gone and then starts again. Feel free to change the Sleep() values to suit.

Edited by LxP

Share this post


Link to post
Share on other sites

in that case....

this is amazing! XD just what i wanted to make

thnx alot

Share this post


Link to post
Share on other sites

o damn i found a problem =(

there are more then 1 on screen at a time, how can i make it on a random one , (5000) then hit another one?

cause right now when there are more then one on screen, it clicks on one of them, and then it stops working after ( even when its still on the screen somewhere else)

also, is there anyway i can make it so that, instead of click on the color, it clicks 1/2 inch below the color?

Share this post


Link to post
Share on other sites

actually i think it would be a lot easier if the program just keeps clicking and clicking at a random k0k0k0 when its present and just sleeps when not

Share this post


Link to post
Share on other sites

try this

hotkeySet("{ESC}", "quit")
func quit()
    exit
endFunc

local $rgb = 0xc0c0c0
local $xy

while (1)

    $xy = pixelSearch(0, 0, @desktopWidth, @desktopHeight, $rgb)

  ; if colour is found
    if not(@error) then
        mouseClick("primary", $xy[0], $xy[1] + 20); + 20 for apx 1/2 inch lower
      ; wait until colour is gone from that spot
       ;while (pixelGetColor($xy[0], $xy[1] = $rgb); take out while/sleep
       ;    sleep(100)
       ;wEnd
    else
        sleep(5000); changed to 5000 ( 5 seconds)
    endIf

wEnd

not tested

8)


NEWHeader1.png

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