Jump to content

Screen_Capture More Info


Recommended Posts

Morning all,

I run the following script in order to capture & save select areas of the screen via the command prompt i.e. via a series of command line inputs once the program is compiled as an executable.

Include <ScreenCapture.au3>

;Local $dir =$CmdLine[6]

Local $title = $CmdLine[1]

Local $left  = $CmdLine[2]
Local $top = $CmdLine[3]
Local $right = $CmdLine[4]
Local $bottom = $CmdLine[5]

_ScreenCapture_Capture(@ScriptDir & $title, $left, $top, $right, $bottom)

If Not (@error == 0) Then
   ConsoleWrite("failed")
Else
   ConsoleWrite("done")
EndIf

I am struggling to understand how the Screen_Capture function in AutoIt really works.

For example, the function works very well when I return the following line into my command prompt:

Quote

\image1.png 0 0 1920 1039 > temp.txt

However the function does not work for:

Quote

\image1.png 0 91 1920 1039 > temp.txt

The application appears to work for a very select number of pixel combinations only. In short, I want to know why this is the case, am I missing something important?

Moreover, is the Screen_Capture function set up such that it will capture the image in the format specified, or merely convert e.g. jpeg into the desired format as specified by .png or .bmp extension for example. What is the native file type of the function and if conversion does take place, what is the maximum resolution possible via this function?

I want to use Screen_Capture as it allows for pixel selection, which will render my work more efficient, I do not want to revert to whole-screen capture solutions.

Thanks in advance,

Joseph

Link to comment
Share on other sites

Works fine for me with every size i tried. Don't know what the problem is.

 

Try if it fails without console compilation

#include <ScreenCapture.au3>

Local $title = "Test.png"

_ScreenCapture_Capture(@ScriptDir & "\" & $title, 0, 91, 1920, 1039)

If @error <> 0 Then
    ConsoleWrite("failed" & @CRLF)
Else
    ConsoleWrite("done" & @CRLF)
EndIf

 

If it fails, then copy function '_ScreenCapture_Capture' from includes to your script and test if 'WinAPI_BitBlt' fails (ConsoleWrite(_WinAPI_GetLastError())) or where the problem is.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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

×
×
  • Create New...