nowayn Posted September 5, 2018 Share Posted September 5, 2018 So im trying to do some screenshots with autoit but I can't even get the most basic script to actually save the file anywhere. #include <ScreenCapture.au3> _ScreenCapture_Capture(@ScriptDir & '\1.jpg') This code won't save the image in the script directory even though I'm running AutoIt as admin and have full control on all users and groups in that folder. I'm guessing its something to do with not being allowed to save but why? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted September 5, 2018 Share Posted September 5, 2018 Hi @nowayn, and welcome to the AutoIt Forum What @error is returned from the function? #include <ScreenCapture.au3> _ScreenCapture_Capture(@ScriptDir & '\1.jpg') If @error Then ; Error Checking ConsoleWrite("Error taking the Screenshot. Error: " & @error & @CRLF) EndIf nowayn 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
nowayn Posted September 5, 2018 Author Share Posted September 5, 2018 2 minutes ago, FrancescoDiMuro said: Hi @nowayn, and welcome to the AutoIt Forum What @error is returned from the function? #include <ScreenCapture.au3> _ScreenCapture_Capture(@ScriptDir & '\1.jpg') If @error Then ; Error Checking ConsoleWrite("Error taking the Screenshot. Error: " & @error & @CRLF) EndIf -2 Link to comment Share on other sites More sharing options...
markyrocks Posted September 5, 2018 Share Posted September 5, 2018 (edited) Try using #RequiresAdmin. My guess would be your trying to save inside a folder that you don't have permission. A way to tell if it was actually captured you should be able to paste to paint manually. I think I had to always do something like $hBitmap=screencapture_capture() Screencapture_saveimage("path\", $hBitmap) Edited September 5, 2018 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
nowayn Posted September 5, 2018 Author Share Posted September 5, 2018 6 minutes ago, markyrocks said: Try using #RequiresAdmin. My guess would be your trying to save inside a folder that you don't have permission. A way to tell if it was actually captured you should be able to paste to paint manually. #RequireAdmin doesn't help either and nothing happens if I try to paste it into paint Link to comment Share on other sites More sharing options...
markyrocks Posted September 5, 2018 Share Posted September 5, 2018 (edited) Try making a file the name you want and put a random image in and see if it saves over it or if it just snaps a shot of the image in the file. Unless you're deleting the screenshot in a part of your script we cant see then you should be able to open paint and paste the screenshot in. Its either trying to take a screenshot of a file that doesn't exist or its @error and you have some other issue beyond my comprehension. Edited September 5, 2018 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
nowayn Posted September 5, 2018 Author Share Posted September 5, 2018 nothing changes by putting a file with the same output name in the folder and #include <ScreenCapture.au3> Local $hBmp $hBmp = _ScreenCapture_Capture("") _Screencapture_saveimage(@ScriptDir & "\1.jpg", $hBmp) doesn't seem to work either Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted September 5, 2018 Share Posted September 5, 2018 Are you compliant with the version number? It specifically states "screencapture" being a problem in 3.3.14.3/4 nowayn 1 Link to comment Share on other sites More sharing options...
markyrocks Posted September 5, 2018 Share Posted September 5, 2018 (edited) 32 minutes ago, nowayn said: nothing changes by putting a file with the same output name in the folder and #include <ScreenCapture.au3> Local $hBmp $hBmp = _ScreenCapture_Capture("") _Screencapture_saveimage(@ScriptDir & "\1.jpg", $hBmp) . Take a look here, https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_BitmapCreateHBITMAPFromBitmap.htm. I think this was how I fixed it when I was using screen capture... That GDI plus is pretty neat, lot of different tools in there to manipulate images while they're in temp memory. Edit...nm. maybe try saving the file as a .bmp. an hbitmap is a handle to a bitmap and there might be some issue with the conversion. Edited September 5, 2018 by markyrocks nowayn 1 Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
nowayn Posted September 5, 2018 Author Share Posted September 5, 2018 3 hours ago, ViciousXUSMC said: Are you compliant with the version number? It specifically states "screencapture" being a problem in 3.3.14.3/4 1 sry, fell asleep. it said i was running 3.5.4 but it appears that it doesn't exist. decided to update anyway and now it works soo i guess it must have been that. THANKS SO MUCH 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