Jump to content

Screen scraping


Nine
 Share

Recommended Posts

I'm trying to read a pixel from the screen of a particular program. It always comes out black (0x000000). One should be white, the other should be blue. Is there some aspect of this program that prevents reading a pixel?

#include <GetScreen.au3>

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

Run("C:\Program Files (x86)\YT Saver\ytsaverw.exe",@TempDir,@SW_MAXIMIZE)
Opt("WinTitleMatchMode", 2)
_WinWaitActivate("YT Saver","")
$Handle = WinGetHandle("YT Saver")
Sleep(5000)
$aWin = WinGetPos($Handle)
$Width = $aWin[2]
$Height = $aWin[3]
_GetScreen_Initialize($Width, $Height)
_GetScreen_GetWindow($Handle)
$Color = _GetScreen_GetPixel(350,200)
$Color2 = _GetScreen_GetPixel(110,90)
WinClose($Handle)
$Color=Hex($Color,6)
$Color2=Hex($Color2,6)
MsgBox(0,"Info",$Color & "  " & $Color2 & @CRLF & $Width & " " & $Height)

 

Edited by JonF
Link to comment
Share on other sites

Yes, like previously discussed in this topic, some windows do not support WM_PRINT or WM_PRINTCLIENT messages.  You may try _GetScreen_GetWindow with flag set at 2.

But since you are activating the window, I strongly suggest that you use _GetScreen_GetScreen instead.

Edited by Nine
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...