myspacee Posted March 27, 2009 Share Posted March 27, 2009 (edited) hello, Need to screen capture focused in my desktop but different func return different value to accomplish this task. Understand that i must use @DesktopWidth @DesktopHeight but going mad. anyone can help me? m. Edited March 28, 2009 by myspacee Link to comment Share on other sites More sharing options...
picea892 Posted March 27, 2009 Share Posted March 27, 2009 Is this what you are looking to do #include <ScreenCapture.au3> $h = WinGetHandle("Program Manager") _ScreenCapture_CaptureWnd(@ScriptDir & "\testing.bmp", $h,0,0,@DesktopWidth,@DesktopHeight) Link to comment Share on other sites More sharing options...
myspacee Posted March 28, 2009 Author Share Posted March 28, 2009 thank you picea,but your code screencapure whole desktop.I want to sreencapture window with focus, post image to define better my request:with:$size = WinGetPos("[active]") tooltip($size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3],0,0)I obtain :x = $size[0]y = $size[1]width = $size[2]height = $size[3]For difference with @DesktopWidth @DesktopHeight and these values, I should obtain :left = ?top = ?right = ?bottom = ?But can't deduce whic are values to use...Anyone can help ?Thank you,m. Link to comment Share on other sites More sharing options...
Authenticity Posted March 28, 2009 Share Posted March 28, 2009 #include <ScreenCapture.au3> Run('calc.exe') WinWaitActive('Calculator') Dim $aPos = WinGetPos('Calculator') _ScreenCapture_Capture(@ScriptDir & '\TestCalc.bmp', $aPos[0], $aPos[1], $aPos[0]+$aPos[2], $aPos[1]+$aPos[3]) ShellExecute(@ScriptDir & '\testcalc.bmp') After you have the position array you need to add the width to the x coordinate to get the right and the same for the height because specifying $iLeft as 44 and the window width is 55 but sending $iRight 55 is wrong, it should be 99. Link to comment Share on other sites More sharing options...
myspacee Posted March 28, 2009 Author Share Posted March 28, 2009 perfect, need small adjustment for window > <, @DesktopWidth @DesktopHeight, but resolve. thank you. m. Link to comment Share on other sites More sharing options...
myspacee Posted March 30, 2009 Author Share Posted March 30, 2009 made this little script, that 'map' in middle mouse button abilty to snapshot windows with focus: #Include <Misc.au3> #include <ScreenCapture.au3> #include <Date.au3> #Include <WinAPI.au3> $dll = DllOpen("user32.dll") while 1 ;if middle mouse is pressed If _IsPressed("04", $dll) Then $aPos = WinGetPos("[active]") ; Capture window with focus _ScreenCapture_Capture(@ScriptDir & '\snap\TestCalc' & _Date_Time_GetTickCount() & '.jpg', $aPos[0], $aPos[1], $aPos[0]+$aPos[2], $aPos[1]+$aPos[3]) sleep(1000) EndIf sleep(100) wend DllClose($dll) But often script exit with an error _WinAPI_CreateCompatibleBitmap: Parametro non corretto. I think I must delete GDI resource every cicle, but can't understand how, anyone can help me ? thank you, m. 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