Jump to content
Sign in to follow this  
Miliardsto

Reading pixel colors from few windows at same time

Recommended Posts

Miliardsto

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

Share this post


Link to post
Share on other sites
Aelc

i think its possible.

just one question to explain

are the windows all @SW_maximize and @SW_show?

  • Like 1

Share this post


Link to post
Share on other sites
Miliardsto

yes. all show and maximized.

I asked a bit wrong question.

Hmm thats the right answer to this   @Nine

Share this post


Link to post
Share on other sites
Miliardsto

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.

Share this post


Link to post
Share on other sites
Aelc

 

$hWnd = WinList ("Window","")
For $i = 1 to $hWnd[0][0]
$Coord = PixelSearch(200, 200, 10, 10, "color" ,"","",$hWnd[$i][1])
If Not @error Then
    MsgBox(64, "", "X and Y are: " & $Coord[0] & "," & $Coord[1])
EndIf
Next

you can use the handle of windows in the pixelsearch 

Edited by Aelc

Share this post


Link to post
Share on other sites
Nine

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.

Share this post


Link to post
Share on other sites
DonTutti

Can You please explain how to do loop with TimerInit? I readed many examples of it but I cant understound it ;/

Share this post


Link to post
Share on other sites
Bert

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. 
  • Thanks 1

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  

  • Similar Content

    • Miliardsto
      By Miliardsto
      hello Im wondering if it is possible to process image in autoit like this
      1. firstly there is colorfull wallpaper
      2. Fill all colors (exception rose color) - with white
      3. Fill rose color with black color
      I see Gdi functions have things to manipulate images
      https://imgur.com/a/lFdY26g
    • AndyS01
      By AndyS01
      I want to create a slider that has values representing colors, like the slider on the _ChooseColor() GUI in the Misc.au3 UDF, but the max value for a slider is 32767.  
      Here is my test code:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> #include <Misc.au3> $hGUI = GUICreate("Test", 100, 560) $BtnID = GUICtrlCreateButton("Choose", 10, 10, 50, 25) ;~ GUICtrlSetOnEvent($BtnID, "handle_choose_btn") $flags = BitOR($TBS_AUTOTICKS, $TBS_VERT) $iSliderID = GUICtrlCreateSlider(10, 50, 40, 420, $flags) $hSlider_hWnd = GUICtrlGetHandle($iSliderID) $iMaxVal = 32767 GUICtrlSetLimit($iSliderID, $iMaxVal, 0) ; change min/max value GUISetState() GUIRegisterMsg($WM_VSCROLL, "WM_V_Slider") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYUP ToolTip("") case $BtnID handle_choose_btn() EndSwitch WEnd ; React to a slider movement Func WM_V_Slider($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam If $lParam = $hSlider_hWnd Then $iValue = GUICtrlRead($iSliderID) ConsoleWrite("+++: $iValue = " & $iValue & @CRLF) ToolTip(getRGB($iValue)) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_V_Slider ; Extract the RGB components from the color value Func getRGB($iColorVal) Local $hexstr, $b, $g, $r, $rgb $hexstr = StringFormat("%06X", $iColorVal) $r = StringMid($hexstr, 1, 2) $g = StringMid($hexstr, 3, 2) $b = StringMid($hexstr, 5, 2) $rgb = StringFormat("" & $iColorVal & " - rgb: %02s %02s %02s", $r, $g, $b) Return ($rgb) EndFunc ;==>getRGB Func handle_choose_btn() $color = _ChooseColor(2, 255, 0, $hGUI) ConsoleWrite("+++: $color = " & Hex($color, 8) & @CRLF) EndFunc ;==>handle_choose_btn  
    • duzers
      By duzers
      Hello,
      I have to write script  ( as simple as possible) to read messages from other scripts (something like queue to run). How to start? Which groups of functions? Any ida?
      THX
    • xiantez
      By xiantez
      Hey Community,
      I was changing around my color scheme manually for syntax highlighting. I really enjoy using a dark background color. However, this seems to be problematic because my blinking cursor is also very dark. Is there a setting in the ScITE config where I can manipulate the blinking cursor to be a different color like "white" so it is easy to spot when coding. The closest thing I found was "Caret Line Color", but this just changes the line highlight.  Your help is greatly appreciated!!

    • RaiNote
      By RaiNote
      Hi,
      I don't know why but
      This Code
      and this
      exceed with their error codes~ Maybe this caused it reads 0x.. wrong i don't know how to fix this currently.
      <snip di snip>
      Normally there would be another Value then 0 or 1
×