Jump to content

Recommended Posts

Posted

Hello.

I got a big problema that I tried to solve reading and reading, but I'm a newbie in Autoit.

I got this simple script:

#include <ScreenCapture.au3>
#include <File.au3>

HotKeySet("{PRINTSCREEN}", "SS")

While 1
    Sleep(100)
WEnd

Func SS()
    _ScreenCapture_Capture(@MyDocumentsDir & "\screenshot.jpg")
EndFunc

How can I set to everytime that I press PRINTSCREEN, a new file named with hour and date be created?

 

Thanks in advance.

Posted

And another example that generates unique file names with a format  that chronologically sorts on name.

#include <ScreenCapture.au3>

HotKeySet("{PRINTSCREEN}", "SS")
HotKeySet("{ESC}", "Terminate")

While 1
    Sleep(100)
WEnd

; Can provide 999 unique file names per hour in the format of SCYYYYMMDDHH_001.jpg to SCYYYYMMDDHH_999.jpg
Func SS()
    Local $aFileName, $iCount = 0
    While 1
        $iCount += 1
        $aFileName = @MyDocumentsDir & "\SC" & @YEAR & @MON & @MDAY & @HOUR & _
                     "_" & StringRight("00" & $iCount, 3) & ".jpg"
        If FileExists($aFileName) = 0 Then ExitLoop
    WEnd
    _ScreenCapture_Capture($aFileName)
    ShellExecute($aFileName)
EndFunc   ;==>SS

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

  • 2 weeks later...

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