Sign in to follow this  
Followers 0
matrix10657

Pixel search and shade-variation

3 posts in this topic

Can someone please explain to me how to use the shade-variation feature in the Pixelsearch command. For example I have a hex color that is as follows. 0xCFC3C2 , however, the color can change but the hex code always has 0xC(x)C(x)C(x) (with X being a random letter or number). Is there a way I can get pixelsearch to detect a color with 0xC(x)C(x)C(x) in it?

Share this post


Link to post
Share on other sites



Can someone please explain to me how to use the shade-variation feature in the Pixelsearch command. For example I have a hex color that is as follows. 0xCFC3C2 , however, the color can change but the hex code always has 0xC(x)C(x)C(x) (with X being a random letter or number). Is there a way I can get pixelsearch to detect a color with 0xC(x)C(x)C(x) in it?

The shade variation works by putting a number into its parameter from 1 to 255. The higher the number, the higher the shade variation. So, if the number is 1, it will check to see if a pixel color exists with a shade variation higher and lower for each of the RBG colors. If the number is 10, it will check to see if there is a shade of color higher or lower by 10 shades.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The shade variation works by putting a number into its parameter from 1 to 255. The higher the number, the higher the shade variation. So, if the number is 1, it will check to see if a pixel color exists with a shade variation higher and lower for each of the RBG colors. If the number is 10, it will check to see if there is a shade of color higher or lower by 10 shades.

To check for a pixel 0xC?C?C?

for $y = $top to $bottom
     for $x = $left to $right
          $c=pixelgetcolor($x,$y)
          $cm = bitand($c,0xf0f0f0)
          if $cm = 0xC0C0C0 then
               $foundone = true
               exitloop[2]
          endif
     next
next
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  
Followers 0