Detecting colour changes on active window

Get help with using AutoHotkey and its commands and hotkeys
hexicus
Posts: 1
Joined: 23 May 2016, 10:33

Detecting colour changes on active window

23 May 2016, 10:42

I'm trying to write a script that would detect a colour change on a area of the screen and run a command I know of the following, I'm just not sure how to write such a script with them:
PixelGetColor
PixelSearch

I'm wondering if anyone knows how to or is able to help me out.
Thanks
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26
Facebook: https://www.facebook.com/floris.vos.77

Re: Detecting colour changes on active window

26 May 2016, 12:00

Yeah, many of my scripts use the following little loop to check if a page has loaded:
(I don't have my scripts here so not 100% sure if I will write it 100% correct, I just write it from memory)

Code: Select all

PixelGetColor, Color, X, Y
while Color != 0xFFFFFF
{
PixelGetColor, Color, X, Y
sleep 200
}
Or possibly:

Code: Select all

loop
{
PixelGetColor, Color, X, Y
PixelGetColor, Color2, X, Y
while Color2 = color
{
PixelGetColor, Color, X, Y
sleep 200
}
Msgbox It changed! :)
}

And, last but not least, you could use two loops to make arrays of all the pixelcolours in an area, and compare them with an array you generate before the loop starts. Maybe I'll try coding that one of these days. Sounds kind of fun.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], CluelessHotKeyUser, mikeyww, omareg94, songdg, yumuffin and 41 guests