Jump to content

Recommended Posts

Posted (edited)

Im wondering if its possible to read pixel colors from not only from top window.

For example I got a few windows with images how (in attachment video) . Is it possible to read pixel color for example 200px, 200px from top left ?

Can i make something like winlist for the same window names and then get handles for every listed exact name window and then read for every window pixel color for example: 200px, 200px from top left ?

https://streamable.com/l3pit

 

2018-12-10 01-02-38.mp4

Edited by Miliardsto
Posted

You could do something like this :

#include <ScreenCapture.au3>

Opt ("MustDeclareVars", 1)

Global $ahWnd = WinList ("Something here"), $aHBitMap[$ahWnd[0][0]]

For $i = 1 to $ahWnd[0][0]
  WinActivate ($ahWnd[$i][1])
  WinWaitActive ($ahWnd[$i][1])
  $aHBitMap[$i-1] = _ScreenCapture_CaptureWnd ("",$ahWnd[$i][1],0,0,200,200,False)
Next

 

Posted

Is there a possibility to check Pixelgetcolor from for example 3 windows at the same time, in real time, without using screen capturing?

1 window is on top

2,3 windows below the first one

These pixels colours would be changing from time to time and in loop I want to check their colors using timers every 5 seconds for example.

So making scrrenshots would not be appropriate in this case.

Posted

You can use AdlibRegister ("function", 5000) to launch a function every 5 secs that would check the pixels like @Aelc showed you. Or you can use TimerInit () along with TimerDiff ($hTimer) in a loop until you reach 5 secs.

Posted
Global $hTimer = TimerInit (), $iTime
While True
  Do something here or Sleep (50)
  $iTime = TimerDiff ($hTimer)
  if $iTime >= 5000 then ; when it reach 5 secs, execute something
    Do someother things here
    $hTimer = TimerInit () ; reinit timer
  endif
Wend

Self-explanatory.

Posted

Several things

  1. If you want to look at a pic as you show in the video, then why not just look at the pic and not windows explorer view?
  2. Why do you need to use pixel searching in the first place? Have you tried to ID the control in question? Using pixel searching is VERY UNSTABLE and causes many scripts to break.
  3. What is the ACTUAL application you are wanting to automate? I ask for in MANY CASES there is a script that will do it so having to reinvent the wheel is a waste of time when we can point you in the right direction. 

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
×
×
  • Create New...