Jump to content

remove date & time


Ese
 Share

Recommended Posts

Howdy

i 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)

EndIf

and in the log i get:

2007-08-30 22:43:44 : C193R-9

any chance to get rid of the date and time that the script automaticaly puts there?

cheers

Ese

Link to comment
Share on other sites

_FileWriteToLine is fine if hes tracking the current line number but a log just appends to whats already there.

not sure i understand you

do 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 runs

cheers

Link to comment
Share on other sites

oh it's working well like this:

$file = FileOpen("c:\font.txt", 1)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine($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 by Ese
Link to comment
Share on other sites

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

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