Jump to content

_ScreenCapture_SaveImage not saving images


Ashen
 Share

Go to solution Solved by UEZ,

Recommended Posts

Hey Guys,

I am running a very simple code intended to create a screenshot of a part of my screen.

My problem is that only the first screenshot I take is saved (and even that doesn't always happen), but then after I call my function for the second time the older screenshot is not over-written (and if I delete the old screenshot then no new screenshot is created).

Here's my code:

#include <ScreenCapture.au3>

dim $sFilePath = "E:\tmp.BMP"
dim $OCR_Rectangle[4] = ["760", "480", "1068", "522"]

_ScreenCapture_SaveImage($sFilePath, _ScreenCapture_Capture("",$OCR_Rectangle[0], $OCR_Rectangle[1], $OCR_Rectangle[2], $OCR_Rectangle[3],False),True)

I am losing hope here, guys. Any chance any of you have any idea what's going on?

Link to comment
Share on other sites

Why are you nesting the _ScreenCapture functions?
 
_ScreenCapture_Capture($sFilePath,$OCR_Rectangle[0], $OCR_Rectangle[1], $OCR_Rectangle[2], $OCR_Rectangle[3],False)

should also do it.

Br,
UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Solution

Check out the coordinates you want to capture -> it shouldn't be strings in this case because "760" is greater than "1068" and error -1 will be set.

#include <ScreenCapture.au3>

dim $sFilePath = "E:\tmp.BMP"
dim $OCR_Rectangle[4] = [760, 480, 1068, 522]
ConsoleWrite(_ScreenCapture_Capture($sFilePath,$OCR_Rectangle[0], $OCR_Rectangle[1], $OCR_Rectangle[2], $OCR_Rectangle[3],False) & @LF)

Unfortunately _ScreenCapture_Capture() doesn't convert the input to an integer value automatically.

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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