JensB Posted November 2, 2022 Share Posted November 2, 2022 Hi World, I am an AutoIt Newb. I start with a simple task. Starting an app, making some mouse clicks and then saving a picture of the app. The function to save the picture looks like. Func Capture($vName, ByRef $sClass) Local $hWindow = WinGetHandle($sClass) Local $path = @ScriptDir & "\..\Results\" & $vName _ScreenCapture_SetBMPFormat(2) _ScreenCapture_CaptureWnd($path & ".bmp", $hWindow ) EndFunc The issue is that the saved picture differs in size dependent on the monitor I use. The app have a screen size of 800x480 pixel (exclusive application borders) . AutoIt Window Info shows me a size of 806x509pixel (with application borders). My expectation is, when I call _ScreenCapture_CaptureWnd I got an image of that size. I have here an Laptop with a resolution of 1920x1080pixel. Additonally there are 2 Monitors connected. Each with a resolution of 1920x1200. AutoIt Window Info show me a size of my application 806x509pixel on each monitor. But when I execute _ScreenCapture_CaptureWnd() The resulted image differs in size. On the 1920x1200 Monitors I got an image of 802x507pixel, as ecpected. But when I do the same on my 1092x1080pixel monitor then i got an image of 1002x633pixel. It is the same content and same scaling but a bigger picture. I modified my capture routine a bit to take the Application width and height into account. With this code I got not the whole picture on my 1092x1080pixel monitor, while I got the whole picture on my 1920x1200Monitors. Func Capture($vName, ByRef $sClass) Local $hWindow = WinGetHandle($sClass) Local $aPos = WinGetPos($sClass) Local $path = @ScriptDir & "\..\Results\" & $vName ;& "_w" & $aPos[2] & "_h" & $aPos[3] _ScreenCapture_SetBMPFormat(2) _ScreenCapture_CaptureWnd($path & ".bmp", $hWindow, 0, 0,$aPos[2],$aPos[3], false ) EndFunc Does any one knows why _ScreenCapture_CaptureWnd behaves differently? Thank you in advance. Backgound Information: I want to use AutoIt für testing some UIs. And the saved images shall be compared with some referecne picture. Therefore size matters in my case. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now