Search the color contain Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Haakan
Posts: 2
Joined: 17 Aug 2022, 01:45

Search the color contain

Post by Haakan » 17 Aug 2022, 10:17

Hi everyone
I need some help for pixelsearch. I search in screen a color contain A,A for example color is 0xBEA1A2 or 0xC0A7AB or 0xBCA3A8 etc.
How I search color.
This script is not working

Code: Select all

PixelSearch, x, y, 0, 0, 1700, 800, color contains A,A , 0 , RGB Fast
Any help would be nice.Thanks
Last edited by Haakan on 18 Aug 2022, 00:01, edited 1 time in total.

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Search the color contain  Topic is solved

Post by mikeyww » 17 Aug 2022, 10:25

Welcome to this AutoHotkey forum!

What should the quotation mark do?

You cannot make up your own syntax. You have to use what AHK provides. See the documentation and examples there. You can specify a color as well as a variation. Example

If needed, you can do three searches, and then use the results according to what you need.

Code: Select all

CoordMode, Pixel
CoordMode, Mouse
For each, rgb in [0xBEA1A2, 0xC0A7AB, 0xBCA3A8]
 PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, rgb,, Fast RGB
Until !ErrorLevel
If (x > "") {
       MouseMove, x, y
       MsgBox, 64, Success, % Format("{:#X} at ({}, {})", rgb, x, y)
} Else MsgBox, 48, Failure, Not found!

User avatar
Haakan
Posts: 2
Joined: 17 Aug 2022, 01:45

Re: Search the color contain

Post by Haakan » 18 Aug 2022, 00:37

mikeyww wrote:
17 Aug 2022, 10:25

Code: Select all

CoordMode, Pixel
CoordMode, Mouse
For each, rgb in [0xBEA1A2, 0xC0A7AB, 0xBCA3A8]
 PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, rgb,, Fast RGB
Until !ErrorLevel
If (x > "") {
       MouseMove, x, y
       MsgBox, 64, Success, % Format("{:#X} at ({}, {})", rgb, x, y)
} Else MsgBox, 48, Failure, Not found!
Thanks for reply.
Actually the problem is: The color changes constantly as the screen is moving and there are so many variations.
Meanwhile, the similarity I found in the same color variations is that there are two letters A and A.

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Search the color contain

Post by mikeyww » 18 Aug 2022, 06:17

I've never had to deal with a moving screen. AHK exceeds expectations! Glad to hear you have it working. :)

Post Reply

Return to “Ask for Help (v1)”