Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Pixel Info & Comparing It
Ok I dont think many would be able to do this so mainly this question is for Gint. but any one else free feel to help.

What is the best way i could get the pixel of a window and compare it in a contious string untill it is changed, so that i know the window has changed? I dont really know how to explain it but basically i want it to do this. [best way i can explain] get the pixel of window 1. then inside a contious string get it again and keep comparing itself until it has changed. Then to stop when it has changed. I'd appreciate it greatly if someone could show me an example how to do this please.
This may be helpful, i have no idea if this is the 'best' way im sure Gintaras will correct me.

Function is_there
Copy      Help
function# int'windo [&retvar]

int w1 = act(windo)

int r1 g1 b1
int r2 g2 b2

// Pixel Locations
int p1x = 512
int p1y = 556
int p2x = 565
int p2y = 556

// Get Pixel Colors
int p1col = pixel(p1x p1y w1)
int p2col = pixel(p2x p2y w1)

// Convert Colors
ColorToRGB(p1col &r1 &g1 &b1)
ColorToRGB(p2col &r2 &g2 &b2)

// Check Colors
if(r1=198 or r1=189 or r1=214 or r1=222 or r1=206 or r1=247)
,if(r2=198 or r2=189 or r2=214 or r2=222 or r2=206 or r2=247)
,,if(&retvar) retvar = 1            
,,ret 1
if(&retvar) retvar = 0
ret 0
Basically, when you run this, it checks the color of two pixels at the specified locations relative to the window W1. It checks to see if the pixels for both fit within the specified R values. It has so many checks because the colors can change in my case but you could just do something like:

Copy      Help
if(r1=100 && g1=100 && b1=100)
But of course you also need to know what color you're supposed to find. You can figure that out with a graphics app color picker or running it and dumping it to the output ie:

Copy      Help
out "%i %i %i" r1 g1 b1
Then you just would keep running the check function until it returns true

Function is_there
Copy      Help
,,wait 1
tyvm bro this will be helpful
See also:
floating toolbar -> windows, controls -> find image -> wait until something changes

if there is no 'wait until something changes', install QM 2.3.0,
ok that is a way just not how i needed, is there something that i can use in qm to get pixel?
floating toolbar -> wait -> wait for color

or use
rep and pixel (read in qm help)

Forum Jump:

Users browsing this thread: 1 Guest(s)