## Recommended Posts

Hello autoit community, started using this program, and it's amazing!

So, I want to ask some help from you

My screen resolution is 1440x900, and I want to

width= 717

heigh= 427

If in this mouse possition color is for example ff0000, to push Y letter, is that possible to make it?

p.s. sorry for bad english :/ I hope you understand, what i have written there:)

Edited by oiTommy

##### Share on other sites

Yes, it's very simple.

While
WEnd
If
ElseIf
Else
EndIf
PixelGetColor()
Send()

Edited by JohnOne

Monkey's are, like, natures humans.

##### Share on other sites

While True

\$color = PixelGetColor(714, 452)

If \$color = 16777215 Then

Send("{y 10}")

EndIf

WEnd

i tryed to do something like that, but doesn't work properly o.o

*if in 714, 452 color is white, push g 10times

Edited by oiTommy

##### Share on other sites

doesn't work properly o.o

Elaborate.

Monkey's are, like, natures humans.

##### Share on other sites

\$color = PixelGetColor(717, 427)

how to do pixelgetcolor between 700, 400 to 720, 430 that every pixel inside would be checkt?

##### Share on other sites

\$color = PixelGetColor(717, 427)

how to do pixelgetcolor between 700, 400 to 720, 430 that every pixel inside would be checkt?

\$color = PixelSearch(700, 400, 720, 430, colorYouWant)

##### Share on other sites

so

While True

\$color = PixelSearch(700, 400, 720, 430, 16777215, 16711680, 16646144)

If \$color = 16777215 Or \$color = 16711680 Or \$color = 16646144 Then

Send("{g 10}")

EndIf

WEnd

If i do this one, it will search between 700, 400 to 720, 430 for those colors, and if finds, pushes G letter?

messt up...

Edited by oiTommy

##### Share on other sites

so

While True

\$color = PixelSearch(700, 400, 720, 430, 16777215, 16711680, 16646144)

If \$color = 16777215 Or \$color = 16711680 Or \$color = 16646144 Then

Send("{g 10}")

EndIf

WEnd

If i do this one, it will search between 700, 400 to 720, 430 for those colors, and if finds, pushes G letter?

messt up...

I'm afraid that you wont be able to search for 3 different colors in single pixelsearch function (or am I wrong?)

I guess you would want something like this instead:

Func searchForPixel()
local \$i = 0
While \$i <= 10
Local \$color = PixelSearch(700, 400, 720, 430, 16777215)
If Not @error Then
Send("g")
Else
\$color = PixelSearch(700, 400, 720, 430, 16711680)
If Not @error Then
Send("g")
Else
\$color = PixelSearch(700, 400, 720, 430, 16646144)
If Not @error Then
Send("g")
EndIf
EndIf
EndIf
\$i = \$i + 1
Sleep(1000)
WEnd
EndFunc

Note that this my be hacky solution since I'm quite new to AutoIt.

Edited by Centrally

##### Share on other sites

You see, I need that from 700, 400 to 720, 420 all pixels between theese would be checked, and if there would be any of these 3 colors-

16777215, 16711680, 16646144 , autoit would press g letter

##### Share on other sites

That is a statement. Is there still a question about all the stuff posted for you to play with?

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

You will need to loop through each pixel and test it for the three colours.

Here is a micro example.

For \$y = ... To ...
For \$x = ... To ...
If _IsColour(\$x,\$y) Then
...
EndIf
Next
Next

Func _IsColour(\$x,\$y)
If PixelGetColor(\$x,\$y) = 16777215 Then Return 1
If PixelGetColor(\$x,\$y) = 16711680 Then Return 1
If PixelGetColor(\$x,\$y) = 16646144 Then Return 1
Return 0
EndFunc

Monkey's are, like, natures humans.

##### Share on other sites

And that function above makes 2 unnecessary calls, which I'm sure you can figure out.

Monkey's are, like, natures humans.

##### Share on other sites

Thanks guys, tryed easier way for making it

While True

\$color = PixelSearch(700, 430, 740, 470, 16777215)

If Not @error Then

Send("g")

endif

\$color = PixelSearch(700, 400, 720, 430, 16711680)

If Not @error Then

Send("g")

endif

\$color = PixelSearch(700, 400, 720, 430, 16646144)

If Not @error Then

Send("g")

EndIf

WEnd

Thanks enough for me thank you everyone

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

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