Jump to content

Recommended Posts

Posted

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?

Posted (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 by markyrocks
Posted
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 

Posted (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 by markyrocks
Posted

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

Posted (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 by markyrocks
Posted
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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...