Sign in to follow this  
Followers 0
xuchenxixu

How To Click on Color

5 posts in this topic

hi. how do i write a function such that autoit will click on a cretin color on the screen?

how do i get the color code? and if anyone can write this for me it would be great.

the color is purple as shown in the image in attachment. thank you

the code i have right now is

MouseClick ( "left" , $pixel[0] + 40 , $pixel[1] + 30 , 1,0)

i have no idea what that means and it is not working.

ty

post-32713-1203895685_thumb.jpg

Share this post


Link to post
Share on other sites



hi. how do i write a function such that autoit will click on a cretin color on the screen?

how do i get the color code? and if anyone can write this for me it would be great.

the color is purple as shown in the image in attachment. thank you

the code i have right now is

MouseClick ( "left" , $pixel[0] + 40 , $pixel[1] + 30 , 1,0)

i have no idea what that means and it is not working.

ty

I think you can find everything you need right here.

get pixel

Share this post


Link to post
Share on other sites

I think you can find everything you need right here.

get pixel

I assume you mean PixelGetColor.

Otherwise, perhaps PixelSearch would do what you want? :)

Share this post


Link to post
Share on other sites

I assume you mean PixelGetColor.

Otherwise, perhaps PixelSearch would do what you want? :)

im really new to this. could someone write the command for me

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I'm sorry but asking for someone to write the code for you is bad.

Just have a look at PixelSearch in the helpfile, or PixelGetColor if that's your preferred method(but PixelSearch does basically what you would have to do with PixelGetColor anyways..)

It would look something along these lines:

Dim $Color = 1234567890     ; Color you want to search for
Dim $ColorVariation = 10    ; Shades/Variations of the color specified

While 1 ; infinite loop yay
    $Coords = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $Color, $ColorVariation, 1) ; Search the whole screen
    If Not @error Then
        MouseClick("left", $Coords[0], $Coords[1], 1, 0) ; Click on the position found
    EndIf
    Sleep(250) ; sleep a little to not kill the cpu when looping :P
WEnd

Edit:

The color code can be found by using the AutoIt Window Info tool, that comes with autoit. It displays the color below your mouse pointer in the "Mouse" tab.

Edited by FreeFry

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