# Checking screen for color

## Recommended Posts

This is probably simple for some of you brains out there...

What I'm trying to do is check 2 pixel locations in a browser window, in this case I need 111,60 and 389,110 to be checked for the color red and once it's found have it click that pixel via a mouseclick.

##### Share on other sites

This is probably simple for some of you brains out there...

What I'm trying to do is check 2 pixel locations in a browser window, in this case I need 111,60 and 389,110 to be checked for the color red and once it's found have it click that pixel via a mouseclick.

PixelSearch() in the help file has an example.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

If you just want to check the 2 locations you can use PixelGetColor

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

##### Share on other sites

In the given example in the help file I don't quite understand the Top, Left, Right, Bottom...

\$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )

Seeing as how the windowspy gives you x,y coords how do you plug those into that example? I just can't visualize what area the sample code would be checking.

Thanks.

##### Share on other sites

In the given example in the help file I don't quite understand the Top, Left, Right, Bottom...

\$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )

Seeing as how the windowspy gives you x,y coords how do you plug those into that example? I just can't visualize what area the sample code would be checking.

Thanks.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Perfect. Thank you so much.

##### Share on other sites

You already know the coordinates to check. Therefore this should be viable.

```If PixelGetColor(111, 60) = 0xFF0000 Then
MouseClick("left", 111, 60)
ElseIf PixelGetColor(389, 110) = 0xFF0000 Then
MouseClick("left", 389, 110)
EndIf```
Edited by Zib

##### Share on other sites

heh, i think

If PixelGetColor(x,y) = 0000000 AND PixelGetColor(x,y) = 0000000 Then

~~~~~~

it might work.... i think i pulled it of a few times..

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

##### Share on other sites

You already know the coordinates to check. Therefore this should be viable.

```If PixelGetColor(111, 60) = 0xFF0000 Then
MouseClick("left", 111, 60)
ElseIf PixelGetColor(389, 110) = 0xFF0000 Then
MouseClick("left", 389, 110)
EndIf```

This works much better for what I need. Thanks.

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...