Jump to content

Recommended Posts

Posted

I think I am missing something - sure FileOpen() gives you the ability to close the handle when ever you want. But how do I accomplish the following

Some code....

"DATA 1 "

some more code...

"DATA 2"

additional code...

"DATA 3"

the content inside the "" is what I want to capture inside a file called toto.txt. If I wanted to say store all the information inside "" inside a variable or maybe an array (your recommendations here) - so that I can then flush or write all the information inside the "" one time only. I'll need to be able to destroy the data inside the variable or array after I am done flushing it or writing it. I know that there are different ways to flush or write the data such as FileWrite() or FileWriteLog() etc.... What tool works best for my task is what I need help with.

Posted

Sorry, but I still don't understand why you need to write multiple log entries at once. It would be much easier to write a log entry when the "action" you want to log has occurred.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

The reason is that it's writing to a file across the network. I rather write once vs write multiple times. It conserves bandwidth and its a lot more functional.

Posted

Then use something like this:

While 1
    $sMessage = _Now() & " Test1" & @CRLF
    Sleep(2000)
    $sMessage &= _Now() & " Test2" & @CRLF
    Sleep(2000)
    $sMessage &= _Now() & " Test3" & @CRLF
    _LogToFile(@ScriptDir & "test.log", $sMessage)
WEnd

Collects all messages in a single variable and writes it to the log file at the end of the loop. Notice the "=" in the first assignment and "&=" in the rest.

My UDFs and Tutorials:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...