Sign in to follow this  
Followers 0
ITSky8

How to create log file by date?

3 posts in this topic

Hello!

I know that AutoIT can create log file, but how to create the log file by date? e.g. log20080511.txt log20080512.txt log20080513.txt log20080514.txt etc.

By using the System Time? How to do so?

Share this post


Link to post
Share on other sites



There are some nice macros available :)

FileWrite("log"&@year&@mon&@mday&".txt","Logging something...")

:(


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

My preference is for _FileWriteLog() because it time-tags the entries for you:

#include <File.au3>

Global $sLogFile = StringTrimRight(@ScriptName, 4) & "_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & ".log"
_FileWriteLog($sLogFile, "Script started from: " & @ScriptFullPath)

; ...

_FileWriteLog($sLogFile, "Script complete, normal exit.")

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0