Jump to content
Sign in to follow this  
tymo93

Click a Button by Color.

Recommended Posts

tymo93

I want to click a button by a color I have specified how do I do this? Can anyone provide me with the line script that clicks a button with the color I set?

Share this post


Link to post
Share on other sites
tymo93

can I do it using ControlClick? :-?

Share this post


Link to post
Share on other sites
ZWD40

$var[2] = PixelSearch(-x1-, -y1-, -x2-, -y2-, -colors-)

mouseclick("left", $var[0], $var[1])

Share this post


Link to post
Share on other sites
tymo93

Yes, I found that myself as well !! Thanks anyway .. now I want to put the -colors- with a result from Hex($var, 6) that comes with a hex value :-? How do I do that?

Share this post


Link to post
Share on other sites
ZWD40

i dont understand that post lol

Im assuming youre asking about the syntax for using the hex color code?

0X(insert hex value here)

0XFFFFFF <--white

0XFF0000 <-red

Share this post


Link to post
Share on other sites
tymo93

Yeah I know that... but I have another function which gets the color with PixerGetColor from a different x, y, Local $var = PixelGetColor(111, 174) and the result i use MsgBox(0, "The hex color is", Hex($var, 6)) and after this comes:

$var[2] = PixelSearch(-x1-, -y1-, -x2-, -y2-, -colors-)

mouseclick("left", $var[0], $var[1])

I replace -colors- with? I tried replacing it with Hex($var, 6) but nothing.

Share this post


Link to post
Share on other sites
tymo93

Local $var = PixelGetColor(111, 174)
MsgBox(0, "The decimal color is", $var)
MsgBox(0, "The hex color is", Hex($var, 6))
Local $coord = PixelSearch(175, 148, 70, 70, Hex($var, 6))
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf

This is the whole code I am using. First I want to know if I got the right color before I click it, using MsgBox.

Share this post


Link to post
Share on other sites
Bert

I'm not confortable with this. I strongly suspect this is for something that is against this. No, you haven't said what this is for, but I see little reason to think otherwise.

Usually when I see a pixelsearch being used it is because the controller or item you want to click on isn't a normal controller. It is normally a picture or something that resist automantion and the range searched is very small. When using a large search area I know from experience this usually involves a game of some sort. Seeing how your search area is rather large, this simply strenghtens my belief that you are trying to automate a game of some type.

Care to explain what this is for?

Edited by MPH

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  

×