Jump to content

First time, simple script not working


Recommended Posts

I followed the examples in the docs, but it keeps giving me an error when I run this:

Func woot()
    Local $hBmp
    Local $urmum = "\" & _NowTime ([$sType = 4]) & ".jpg"
    ; Capture full screen
    $hBmp = _ScreenCapture_Capture("")

    ; Save file
    _ScreenCapture_SaveImage(@MyDocumentsDir & $urmum, $hBmp)

EndFunc

Why won't it accept a variable as the file name?

Link to comment
Share on other sites

From the AutoIt help file :-

#include <Date.au3>
_NowTime ( [$sType = 3] )

#include <Date.au3> means:-
                                 To use the _NowTime function, the include file "Date.au3" must be included in the script;

 [$sType = 3] means:-
                              The parameter "$sType" within square brackets is optional;
                              The default value for the parameter "$sType" is 3.
              
A colon,":", should only appear in a file path/file name only after the drive letter.  The colon in hh:mm must be deleted or replaced before appearing in a file name.

#include <ScreenCapture.au3>
#include <Date.au3>

woot()


Func woot()
    Local $hBmp
    Local $urmum = "\" & StringReplace(_NowTime(4), ":", "_") & ".jpg"

    ; Capture full screen
    $hBmp = _ScreenCapture_Capture()

    ; Save file
    _ScreenCapture_SaveImage(@MyDocumentsDir & $urmum, $hBmp)
    ShellExecute(@MyDocumentsDir & $urmum)
EndFunc   ;==>woot

 

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