Jump to content

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_icon=oDx\favicon.ico
#AutoIt3Wrapper_outfile=uPtimeLogger.exe
#AutoIt3Wrapper_Res_Comment=by obscurant1st.biz
#AutoIt3Wrapper_Res_Description=-oDx-
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=obscurant1st.biz
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable
#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")
EndIf
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,$tmp)
FileWrite($logFile,"----------------------" & @CRLF)
FileWrite($logFile,"Start!" & @CRLF)
FileWrite($logFile,"Date:" & @MDAY & "/" & @MON & "/" & @YEAR & @CRLF & "Time:" & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
FileWrite($logFile,"Stop!" & @CRLF)
FileClose($logFile)
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)
    FileClose($tmpfilew)
    sleep(60*1000)
WEnd

pls somebody help me.. :)

--

obscurant1st.biz

Edited by obscurant1st
Link to comment
Share on other sites

Func OnAutoItExit ()

Remarks

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.

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