caiolps Posted January 21, 2017 Share Posted January 21, 2017 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 21, 2017 Moderators Share Posted January 21, 2017 @caiolps didn't read that much did you Look in the help file under Macro Reference; there is a macro for everything you want to do. "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 More sharing options...
JoHanatCent Posted January 22, 2017 Share Posted January 22, 2017 Like this? #include <ScreenCapture.au3> #include <File.au3> $HMSDMYY = @HOUR & "_" & @MIN & "_" & @sec &"_" & @MDAY & @MON & @year & ".jpg" HotKeySet("{PRINTSCREEN}", "SS") While 1 Sleep(100) WEnd Func SS() _ScreenCapture_Capture(@MyDocumentsDir & "\screenshot_" & $HMSDMYY) EndFunc Added minutes and seconds for in case you want more in the Hour? caiolps 1 Link to comment Share on other sites More sharing options...
Malkey Posted January 22, 2017 Share Posted January 22, 2017 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 caiolps 1 Link to comment Share on other sites More sharing options...
caiolps Posted February 1, 2017 Author Share Posted February 1, 2017 Thanks to y'all. But a huge thanks to @Malkey for help me with exactly what I've been lookin for. 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