Hallo,
ich möchte gern mehrere Screenshots machen, habe allerdings drei Bildschirme angeschlossen und fürchte, dass die ScreenShot-Funktion bei negativen Koordinatenangaben durcheinander kommt...
AUSFÜHRUNGSUMGEBUNG
- Windows v10 (aber gleicher Effekt bei Windows v7...)
- Autoit v3.3.15
- drei Bildschirme am Rechner angeschlossen:
X-COORD
negative <- -> positive
|
---------------- ---------------- + ---------
| || || |
| || || |
| || || main |
| screen || screen || screen |
| 02 || 03 || 01 |
| || || |
| || || |
| || | ----------
| || |
---------------- ----------------
Alles anzeigen
Die Ecke links/oben des "screen 01" hat die Koordinate (0,0). Die Koordinatenangaben entsprechen den Ausgaben des Programms "Autoit Window Info". Es ergeben sich negative x-Koordinaten für die Bildschirme 2 und 3
TEST-PROGRAMMCODE
#include <GuiConstantsEx.au3>
#include <ScreenCapture.au3>
#include <File.au3>
#include <Array.au3>
; some settings
$strPathToExe = "c:\Program Files (x86)\Microsoft Office\Office16\powerpnt.exe"
$strDirToPpt = "."
$strFileName = "test.ppt"
;$strFileName = "test__empty.ppt"
$colorForScreenEmptyCheck = 0xFFFFFF
;
; open powerpoint application
;
Run( $strPathToExe & " /s " & $strDirToPpt & "\" & $strFileName ) ;\
; wait for powerpoint to become active
$hdl = WinWaitActive( "[CLASS:screenClass]", "", 5 )
if $hdl = 0 then
MsgBox(0, "ERROR", "Powerpoint could not be opened.")
Exit
endif
;
; get position of relevant window
;
$aPos = WinGetPos($hdl)
$xPos = $aPos[0]
$yPos = $aPos[1]
$width = $aPos[2]
$height = $aPos[3]
_ArrayDisplay($aPos)
;
; check for empty slide on screen
;
; check a box within the screen for a color
; which normally exists in standard presentations
$ret = PixelSearch( _
$xPos+400, _
$yPos+400, _
$xPos+$width-400, _
$yPos+$height-400, _
$colorForScreenEmptyCheck _
)
; if the color was found
If @error <> 1 Then
;
; get screen contents
;
_ScreenCapture_Capture( _
$strDirToPpt & "\test.png" _
, $xPos _
, $yPos _
, $xPos + $width -1 _
, $yPos + $height -1 _
, False _
)
EndIf
;
; leave current presentation
;
; activate presentation window (just in case)
WinActivate( $hdl )
; wait for powerpoint to become active
$hdl = WinWaitActive( "[CLASS:screenClass]", "", 5 )
if $hdl = 0 then
MsgBox(0, "WARNING", "Powerpoint could not be closed.")
Exit
endif
; send ESCAPE character
Send( "{ESC}" )
Alles anzeigen
PROGRAMMABLAUF
Nach dem Start des Skripts passiert folgendes:
(1) die Präsentation wird geöffnet und im Präsentationsmodus auf "screen 03" (mittlerer Bildschirm angezeigt.
(2) die Fenster-Koordinaten werden detektiert. Diese entsprechen den Angaben in "Autoit Window Info" (x=-1920, y=0, width=1920, height=1080)
(3) es wird auf eine "leere" Präsentation geprüft (dies ist hier aber nicht relevant und funktioniert auch)
(4) der Bildschirmausschnitt wird aufgezeichnet (capture)
-> erwartet hätte ich, dass lediglich der mittlere Bildschirm "screen 02" aufgezeichnet wird
-> allerdings werden Bildschirme "screen 02 " und "screen 01" als großes Gesamtbild aufgezeichnet
Wenn ich das Testscript mit einem Rechner ausführe, an dem nur EIN Bildschirm angeschlossen ist, so erfolgt das aufzeichnen wie erwartet. Daher würde ich vermuten, dass _ScreenCapture_Capture() möglicherweise mit negativen Angaben nicht gut klarkommt.
Kennt das jemand? Kann mir jemand helfen?
Danke erstmal.