Jump to content

Recommended Posts

Posted

I have following problem

PrintScreen button captures desktop with app window visible.

Capture with Print Screen

AutoIT seems not to see anything inside this window - PixelGetColor returns a color of the background (or some icon if it is in a way).

Capture captures clear desktop.

Autoit capture

CaptureWindow captures a part of a desktop covered with window.

Autoit window capture

Is there any workaround or am I doing somethin wrong??

Kopernic

Posted

...

Is there any workaround or am I doing somethin wrong??

Kopernic

To see what's wrong you should post your code.

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

To see what's wrong you should post your code.

code is veeery basic :mellow:

#Include <ScreenCapture.au3>
Run("C:\Program Files\xxx.exe","C:\Program Files\xxx")
sleep(10000)
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg")
sleep(1000)
_ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image2.jpg",WinGetHandle("xxx"))
Posted

Hmm,

this is working for me:

AutoItSetOption("WinTitleMatchMode", 4)
#Include <ScreenCapture.au3>
$pid = Run(@SystemDir & "\mspaint.exe")
sleep(2000)
_ScreenCapture_Capture(@ScriptDir & "\Screenshot_full.jpg")
sleep(1000)
_ScreenCapture_CaptureWnd(@ScriptDir & "\Screenshot_window.jpg", WinGetHandle("classname=MSPaintApp"))
ProcessClose($pid)
Exit

Tested on Vista x32.

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

this is working for me:

AutoItSetOption("WinTitleMatchMode", 4)
#Include <ScreenCapture.au3>
$pid = Run(@SystemDir & "\mspaint.exe")
sleep(2000)
_ScreenCapture_Capture(@ScriptDir & "\Screenshot_full.jpg")
sleep(1000)
_ScreenCapture_CaptureWnd(@ScriptDir & "\Screenshot_window.jpg", WinGetHandle("classname=MSPaintApp"))
ProcessClose($pid)
Exit

Tested on Vista x32.

I believe that this could be caused by this specific app - MTGO launcher (exec. name: renamer.exe)

Capture and getpixelcolor work for other "regular" apps like paint or firefox.

No trace of such a problem on google. I thik that somehow app window must be rendered directly into display device, in "empty" window area. Empty=only size, position etc but no content at all...

Any idea?

Posted

I managed to capture an active layered window with this script.

Pressing Alt+"p" captures the active window.

#include <GDIPlus.au3>
#include <ClipBoard.au3>

; http://www.autoitscript.com/forum/index.php?showtopic=115672&view=findpost&p=807792
HotKeySet("p", "Ps")
HotKeySet("!p", "AltPS") ;Shift-Alt-d
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(10)
WEnd

Func Ps()
    Send("{PRINTSCREEN}") ; Screen
    _Main()
    ShellExecute(@ScriptDir & "\Image.jpg")
EndFunc ;==>Ps

Func AltPS()
    Send("!{PRINTSCREEN}") ; window
    _Main()
    ShellExecute(@ScriptDir & "\Image.jpg")
EndFunc ;==>AltPS

Func Terminate()
    Exit 0
EndFunc ;==>Terminate

Func _Main()
    Local $hBmp, $hImage

    If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed")
    $hBmp = _ClipBoard_GetDataEx($CF_BITMAP)
    _GDIPlus_Startup()
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)

    ; Save bitmap to file
    _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Image.jpg") ;$sNewName)

    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_Shutdown()
    _ClipBoard_Close()

EndFunc ;==>_Main
Posted

... and it surely works, as I'm getting some bitmap to work on.

But

it still is not enough to use basic functions like pixelGetColor, pixelChecksum or pixelSearch.

Is there any workaround?

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...