Ravel Posted September 23, 2008 Share Posted September 23, 2008 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 More sharing options...
Kerros Posted September 23, 2008 Share Posted September 23, 2008 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 More sharing options...
Andreik Posted September 23, 2008 Share Posted September 23, 2008 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 More sharing options...
Ravel Posted September 23, 2008 Author Share Posted September 23, 2008 Use _FileWriteLog(). It`s more easy. you mean like: $Count += 1 $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then Exit EndIf _FileWriteLog(); placing it here? FileClose($file) Link to comment Share on other sites More sharing options...
Andreik Posted September 23, 2008 Share Posted September 23, 2008 #Include <File.au3> _FileWriteLog(@ScriptDir & "\MyLog.txt","reset @ sept. 12 2008") When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Kerros Posted September 23, 2008 Share Posted September 23, 2008 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 More sharing options...
Andreik Posted September 23, 2008 Share Posted September 23, 2008 This: #include<File.au3> _FileWriteLog(@ScriptDir&'\Log.log','Reset') Will output: No need to figure out date when using _FileWriteLog Yeah but I though that he want exactly "reset @ sept. 12 2008" When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Ravel Posted September 23, 2008 Author Share Posted September 23, 2008 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 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