;Set options
If Not @LogonMode
Break On
Else
Break Off
EndIf
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')
;Declare our variables
Dim $TimeStamp, $LogFile1, $LogFile2, $Handle, $WL, $OpenFile, $CloseFile
Dim $Result1, $Result2
Dim $Result1string, $Result2string
;Use Split and Join to put the date and time into a variable
$TimeStamp = Trim(Join(Split(@DATE,'/'),'-'))+'_'+Trim(Join(Split(@TIME,':'),''))
;Place our Logfile locations into variables
$LogFile1 = 'I:\TEST\auditfile1.txt'
$logfile2 = 'I:\TEST\auditfile2.txt'
;Place the files we want to get the file time from into variables
$Result1 = GetFileTime('C:\Program Files\filename1.txt',0)
$Result2 = GetFileTime('C:\Program Files\filename2.txt',0)
;Place the full results into variables including a comma for csv style format
$Result1string = $TIMESTAMP + ',' + @WKSTA + ',' + $Result1
$Result2string = $TIMESTAMP + ',' + @WKSTA + ',' + $Result2
;Use FreeFileHandle to find an available file handle to use
$Handle = FreeFileHandle()
If $Handle > 0
$OpenFile = Open($Handle,$LogFile1,5)
If @ERROR
'Error opening LogFile1: ' + @ERROR + ' - ' + @SERROR ?
Else
$WL = WriteLine($Handle, $Result1string)
If @ERROR
'Error updating LogFile1: ' + @ERROR + ' - ' + @SERROR ?
EndIf
EndIf
$CloseFile = Close($Handle)
EndIf
;We close the file and move on to the next file
;If we did not close the file we could not use the same variable for the Handle
$Handle = FreeFileHandle()
If $Handle > 0
$OpenFile = Open($Handle,$LogFile2,5)
If @ERROR
'Error opening LogFile2: ' + @ERROR + ' - ' + @SERROR ?
Else
$WL = WriteLine($Handle, $Result1string)
If @ERROR
'Error updating LogFile2: ' + @ERROR + ' - ' + @SERROR ?
EndIf
EndIf
$CloseFile = Close($Handle)
EndIf