Jump to content

Save Screenshot


Recommended Posts

Hi, I'm very new using Au3 and I've find my first obstacle :P

When I joined here: http://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm

I found quite easy to use this, so I copied the example from below: 

#include <ScreenCapture.au3>

_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg")

This saved a screenshot into MyDocuments.

Now, I've tried to change the directory but then doesn't work.

This is what I've done: 

#include <ScreenCapture.au3>

Global $name

$name = 1
_ScreenCapture_Capture(@ScriptDir & "\Test\" & $name & ".jpg")

Can anybody tell me what's wrong there?

Link to comment
Share on other sites

  • Moderators

It works fine for me. Is the directory created? _ScreenCapture will not create it

 

Edit: Dang, too slow

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Where is @ScriptDir pointing? Is it somewhere you have access to create a file? What if you take the variable out of the mix and type the full path out?

_ScreenCapture_Capture(@ScriptDir & "\Test\1.jpg")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Ok, I've found why. Sry I'm very new to this.

I creted the script in the folder "Examples", from the Autoit folder, and it looks like I don' have the rights to save anythign there.

I created it in another folder new created by me and it works.

Sorry for my noobiness!

Link to comment
Share on other sites

You can do something like this here to debug your code:

#include <ScreenCapture.au3>

Global $name

$name = 1
$path = @ScriptDir & "\Test\" & $name & ".jpg"
ConsoleWrite($path & @LF)
_ScreenCapture_Capture($path)
ConsoleWrite(@error & @LF)

Just check out the console output in SciTE!

Br,

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