Jump to content

Help plz ^^


Recommended Posts

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)

Link to comment
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

Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
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

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...