Jump to content

Screen scraping


Go to solution Solved by Nine,

Recommended Posts

Posted (edited)

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
  • Solution
Posted (edited)

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
  • 2 months later...
Posted (edited)

Example 2 did this to my Scite. Is that expected? I can't interacts with it, I'll have to kill the process. Thank God I save what I'm working on often. X)

Running latest AutoIt on Win11 24H2 x64.

Screenshot2025-01-22151648.thumb.jpg.1bdbdf68dabf894dfdeb8c7d81c61e94.jpg

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

Huh?... I doubt you're going to get anywhere with that report, because I'm being serious.

I've been here for over 18 years. I'm running a triple-monitor setup, so that's what I figured the issue was.

Read the rest of my threads and you'll see that I don't aggravate people. I'm here to learn, build, and occasionally help others. I was just curious, ran your script from ScITE on my 3rd monitor, and my ScITE moved to my middle monitor with no body and I was unable to interact with it.

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted

Well I don't know what to tell you.  I thought you were making some inappropriate trolling joke.  Seems that the WinMove did something wrong in your setup.  I do not have multiple monitors and I am still using Win10.  In any case, I am (of course) unable to replicate the issue and can hardly help you out.  Try running Scite from the first monitor (not maximized), see if that helps.

Posted (edited)

Win11 24H2 X64 - On Primary monitor not maximized.

It was maximized on my far right (3rd) monitor when I ran it last time. *shrug*.

P.S. I'm not sticking with those ScITE colors, I messed it up. X)

Screenshot 2025-01-23 150806.png

0x0000000000050B80
1 = F0F4F9 = 1295139178
2 = F0F4F9 = -72188319
3 = F0F4F9 = 1364808461
4 = F0F4F9 = -1620914717
5 = F0F4F9 = 1364808461
6 = F0F4F9 = -2078673808
7 = F0F4F9 = -1620914717
8 = F0F4F9 = 1364808461
9 = F0F4F9 = 1364808461
10 = F0CB86 = 1364808461
11 = F0F4F9 = 1364808461
12 = F7832E = 1364808461
13 = FE83CF = 1364808461
14 = F0F4F9 = 1364808461
15 = F0F4F9 = 1364808461
16 = F0F4F9 = 1364808461
17 = FAF4F9 = 1364808461
18 = F0F4F9 = 1364808461
19 = F0F4F9 = 1364808461
20 = F0F4F9 = 1364808461

 

Edited by BinaryBrother
Added Details

SIGNATURE_0X800007D NOT FOUND

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
  • Recently Browsing   0 members

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