Jump to content
Sign in to follow this  

log time befire shutting down

Recommended Posts


is there anyway to log the time an date just before the windows is shutdown.

now what i'm doing is updating the time and date continuously on the log..

heres my script.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=by obscurant1st.biz
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
DirCreate("C:\Program Files\Uptime Logger\")
If(FileExists("C:\Program Files\Uptime Logger\UpTimer.exe") = 0) Then
    FileCopy(@ScriptFullPath,"C:\Program Files\Uptime Logger\UpTimer.exe")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Uptime Logger","REG_SZ","C:\Program Files\Uptime Logger\UpTimer.exe")
Dim $logFile = FileOpen("C:\Program Files\Uptime Logger\logFile.txt",1)
Dim $tmpfiler = FileOpen("C:\Program Files\Uptime Logger\tmpfile.txt",0)
dim $tmp = FileRead($tmpfiler)
FileWrite($logFile,"----------------------" & @CRLF)
FileWrite($logFile,"Start!" & @CRLF)
FileWrite($logFile,"Date:" & @MDAY & "/" & @MON & "/" & @YEAR & @CRLF & "Time:" & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
FileWrite($logFile,"Stop!" & @CRLF)
while 1
    $tmpfilew = FileOpen("C:\Program Files\Uptime Logger\tmpfile.txt",2)
    FileWrite($tmpfilew,"Date:" & @MDAY & "/" & @MON & "/" & @YEAR & @CRLF & "Time:" & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
    FileWrite($logFile,"----------------------" & @CRLF)

pls somebody help me.. :)



Edited by obscurant1st

Share this post

Link to post
Share on other sites

Func OnAutoItExit ()


Inside the function, @ExitCode can be used to retrieve the code set by the exit statement.

The mode of exit can be retrieved with @ExitMethod.

0 Natural closing.

1 close by Exit function.

2 close by clicking on exit of the systray.

3 close by user logoff.

4 close by Windows shutdown.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.