Jump to content

_ScreenCapture_Capture not taking full screen shot


tonycst
 Share

Recommended Posts

Partial screen shot is taken.

Sometimes its full screen, sometimes its partial.

So regardless of # of monitors or screen size or video cards, problem is random.

3 different computers used.

One laptop with 2 video Intel and ATI

Desktop computer with Intel video card only.

2nd Desktop computer with ATI video card higher end.

 

All same result. Hid and miss situation.

 

Link to comment
Share on other sites

#include <ScreenCapture.au3>

consolewrite(@AutoItExe & @CRLF)
consolewrite(@AutoItVersion & @CRLF)
consolewrite(@AutoItX64 & @CRLF)
consolewrite(@CPUArch & @CRLF)
consolewrite(@OSArch & @CRLF)
consolewrite(@OSBuild & @CRLF)
consolewrite(@OSServicePack & @CRLF)
consolewrite(@OSType & @CRLF)
consolewrite(@OSVersion & @CRLF)
consolewrite(@WindowsDir & @CRLF)
consolewrite(@TempDir & @CRLF)

for $i=1 to 100
    $scrFile=@TEmpDir & "\screenshot" & $i & ".jpg"
    _ScreenCapture_Capture($scrFile)
;~  consolewrite($scrfile & @CRLF)
Next

 

No problem on my system for above 100 screenshots. 
Maybe your screenshot file is still in use by OS if you do it to quickly after each other to same file?

 

C:\Program Files (x86)\AutoIt3\autoit3_x64.exe
3.3.14.2
1
X64
X64
14393

WIN32_NT
WIN_10
C:\WINDOWS

 

Link to comment
Share on other sites

#include <ScreenCapture.au3>
$JPEG = _ScreenCapture_Capture("")
_ScreenCapture_SaveImage (@DesktopDir & "\Shapshot.jpg",$JPEG)
_WinAPI_DeleteObject ($JPEG)

 

How is that any different ? Its still using _ScreenCapture_Capture which is the root of the problem.
Worked fine on desktop but not on laptop, so i am assuming it will fail at work desktop as well.

Link to comment
Share on other sites

you conclude something i cant. Issue can be in capture or in save. The hbmp reference you get you can analyse on height and width. Which part of screen is captured. What dimension is captured if you get a partial screenshot. Allways same partial or random. Maybe you can try with printscreen putting on clipboard and paste clipboard to file. Maybe update the videodriver if possible.

Link to comment
Share on other sites

Ok solved the problem by specifying dimensions of the screen. (thanks junkew)

$JPEG = _ScreenCapture_Capture("",0,0,@DesktopWidth,@DesktopHeight) shoots 1920x1080 instead of 1536x864 (weird number if you as me)

What does that mean, what function does not work properly, saving or capturing ?

Edited by tonycst
Link to comment
Share on other sites

Take that back. Only works is specifying desktop dimensions but not when using variable.

#include <ScreenCapture.au3>
$Coordinates = WinGetpos ("0.jpg")
$JPEG = _ScreenCapture_Capture("",$Coordinates[0],$Coordinates[1],$Coordinates[2],$Coordinates[3])
_ScreenCapture_SaveImage (@DesktopDir & "\Shapshot.jpg",$JPEG)
_WinAPI_DeleteObject ($JPEG)

Console says: 43x82x458x370 which is exactly what it is
Resulted image 416x289 which is not 458x370
Coordinates are also wrong. Both console and AU3Info say: 43x82 which is correct but the resulting image is way off where it suppose to be.
Look for your self.

The snapshot.jpg is the generated by autoit.
Normal screenshot.jpg is the one i created with PRINTSCREEN button and pasted into picture.

 

So what gives ?

My DPI settings are default, i did not change that ever. Drivers are latest (in any case later then autoit version i have)

I only get this problem on some computers, not all of them.

Shapshot.jpg

Normal screenshot.jpg

Link to comment
Share on other sites

a. Workaround is working. Isn't that good enough?

b. Your details are far from clear

b1. If it works does it work consistently on the same computer?

b2. If it DOES NOT work is it then consistently not working on that computer?

b3. You use winGetPos to get coordinates that you use for _screencapture_capture whereas these coordinates are not interchangable.

c. yes, _screencapture_capture can go wrong if Windows OS or Videodriver gives back internally incorrect screensize which can be caused by some examples I gave earlier
I assume AutoIt uses the same values as are given by below 2 lines of code. You could try to see what happens on the faulty systems

consolewrite(@desktopheight & @CRLF)
consolewrite(@desktopwidth & @CRLF)

d. I have no insight in source of autoit but my logic would be that it uses the normal systemmetrics of the system. So on the incorrect working computers maybe run 

#include <WinAPI.au3>
consolewrite(_WinAPI_GetSystemMetrics(76) & @CRLF)
consolewrite(_WinAPI_GetSystemMetrics(77) & @CRLF)
consolewrite(_WinAPI_GetSystemMetrics(78) & @CRLF)
consolewrite(_WinAPI_GetSystemMetrics(79) & @CRLF)

https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx

 

Edited by junkew
Link to comment
Share on other sites

a) work around did not work.

b ) i provided script exactly as i run it. It works on one computer but not the other. Cant be any more clear.

c) It works on one computer but does not work on the other constantly

 

consolewrite(@desktopheight & @CRLF)
consolewrite(@desktopwidth & @CRLF)

and

$Coordinates = WinGetpos ("0.jpg")

return correct values (different obviously because i am trying to get the size of the windows that i want to take screen shot from) so getting the correct values is not the issue at all because they all return correct.

 

Sometimes screenshot will not even be taken at all.

Everything works find in my bedroom desktop but not on my laptop. Both run same windows 10 both 64bit both have same things installed and same autoit version.

Link to comment
Share on other sites

#include <ScreenCapture.au3>
$Coordinates = WinGetpos ("0.jpg")

consolewrite($Coordinates[0] & @CRLF)
consolewrite($Coordinates[1] & @CRLF)
consolewrite($Coordinates[2] & @CRLF)
consolewrite($Coordinates[3] & @CRLF)

$JPEG = _ScreenCapture_Capture("",$Coordinates[0],$Coordinates[1],$Coordinates[2],$Coordinates[3])
_ScreenCapture_SaveImage (@DesktopDir & "\Shapshot.jpg",$JPEG)
_WinAPI_DeleteObject ($JPEG)

what are the input parameter values. as its undefined in the help file what wingetpos does on a picture it can be that your coordinates from 0.jpg are different or that as 0.jpg does not have a path its finding a different jpg on your different system in a different folder and as such giving inconclusive behavior. Try a path in front of 0.jpg.

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