Ese Posted August 30, 2007 Share Posted August 30, 2007 Howdyi was wondering if there is a way to remove the date and time from a log. i wrote a very simple script that checks for the exsistance of a font, it looks like this:#include <file.au3>if FileExists ( "c:\windows\fonts\oron.ttf" ) Then _FileWriteLog ("c:\font.log", @ComputerName) EndIfand in the log i get:2007-08-30 22:43:44 : C193R-9any chance to get rid of the date and time that the script automaticaly puts there?cheers Ese Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2007 Share Posted August 30, 2007 Use FileWriteLine ( filehandle or "filename", "line" ) Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted August 30, 2007 Share Posted August 30, 2007 #include <file.au3> if FileExists ( "c:\windows\fonts\oron.ttf" ) Then _FileWriteToLine("c:\font.log", 0, @ComputerName, 0) EndIf perhaps. Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2007 Share Posted August 30, 2007 _FileWriteToLine is fine if hes tracking the current line number but a log just appends to whats already there. Link to comment Share on other sites More sharing options...
Ese Posted August 30, 2007 Author Share Posted August 30, 2007 _FileWriteToLine is fine if hes tracking the current line number but a log just appends to whats already there.not sure i understand youdo you mean i should use the _filecreate command then the fileopen and then the filewriteline and put the @computername value to a line so it wont automaticaly put the date?another Q please.. if i need to run this command on more the one computer at the same time and i need only one log file will it add lines to the script with the @computername or will it replace the file everytime the scpript runscheers Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2007 Share Posted August 30, 2007 This code will overwrite the same line in the same file every time it is run: #include if FileExists ( "c:\windows\fonts\oron.ttf" ) Then _FileWriteToLine("c:\font.log", 0, @ComputerName, 0) EndIf If thats not your intent you use _FileWriteLine("c:\font.log",@ComputerName) Link to comment Share on other sites More sharing options...
Ese Posted August 30, 2007 Author Share Posted August 30, 2007 Thanks for the help m8 none of them creates the file it doesnt work Link to comment Share on other sites More sharing options...
Ese Posted August 30, 2007 Author Share Posted August 30, 2007 (edited) oh it's working well like this:$file = FileOpen("c:\font.txt", 1)If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIfFileWriteLine($file, @ComputerName)FileClose($file)i'm going to test it, but do you know maybe if i'll distribute it with SMS2003 to lets say 3000 clients, will there be a problem for the clients to get to the logfile at the same time if they do? Edited August 30, 2007 by Ese Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted August 30, 2007 Share Posted August 30, 2007 This code will overwrite the same line in the same file every time it is run: #include if FileExists ( "c:\windows\fonts\oron.ttf" ) Then _FileWriteToLine("c:\font.log", 0, @ComputerName, 0) EndIf If thats not your intent you use _FileWriteLine("c:\font.log",@ComputerName) I was under the impression that it would append indefinitely. #include <File.au3> _FileWriteToLine ( $sFile, $iLine, $sText [, $fOverWrite] ) Parameters $sFile The file to write to $iLine The line number to write to $sText The text to write $fOverWrite if set to 1 will overwrite the old line if set to 0 will not overwrite ;Example: Write to line 3 of c:\test.txt NOT REPLACING line 3 _FileWriteToLine("c:\test.txt", 3, "my insertion", 0) Sorry for the misunderstanding if I am mistaken. 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