Jump to content

help with a log file


Ravel
 Share

Recommended Posts

I am interested in having auto it write a line to a file such as "crashed at blah blah time" send an enter key and drop to the next line and when the script passes this point again do the same thing at the next time instance here is what I have so far:

$Count += 1
$file = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    Exit
EndIf

FileWrite($file, "Line1"); <-------here is where I want it to write "reset @ sept. 12 2008" then move to the next line in the file and do it over the next time it is reset
FileWrite($file, "Still Line1" & @CRLF)
FileWrite($file, "Line2")

FileClose($file)
Link to comment
Share on other sites

you could just use _FileWriteLog, that appends at the beginning or end of a file one line that automatically has time & data info, plus a message.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

I am interested in having auto it write a line to a file such as "crashed at blah blah time" send an enter key and drop to the next line and when the script passes this point again do the same thing at the next time instance here is what I have so far:

$Count += 1
$file = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    Exit
EndIf

FileWrite($file, "Line1"); <-------here is where I want it to write "reset @ sept. 12 2008" then move to the next line in the file and do it over the next time it is reset
FileWrite($file, "Still Line1" & @CRLF)
FileWrite($file, "Line2")

FileClose($file)
Use _FileWriteLog(). It`s more easy.

When the words fail... music speaks.

Link to comment
Share on other sites

This:

#include<File.au3>
_FileWriteLog(@ScriptDir&'\Log.log','Reset')

Will output:

2008-09-23 14:38:03 : Reset

No need to figure out date when using _FileWriteLog

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Yeah but I though that he want exactly "reset @ sept. 12 2008" :)

Yea kerros was right I was just using that date as an example. But Either way I appreciate the help. I was able to discern what I needed from what you all provided. Thanks again!

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