Ashen Posted December 4, 2013 Posted December 4, 2013 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?
UEZ Posted December 4, 2013 Posted December 4, 2013 (edited) 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 December 4, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Ashen Posted December 4, 2013 Author Posted December 4, 2013 Thanks for the input, UEZ, but I already tried that (and I re-tried it just now) and it still has the same results - no file is saved.
Solution UEZ Posted December 4, 2013 Solution Posted December 4, 2013 (edited) 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 December 4, 2013 by UEZ Ashen 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Ashen Posted December 4, 2013 Author Posted December 4, 2013 Thanks so much! that solved the problem instantly. You've saved me many an hour of frustration
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