Rick,
If you're working in the context of Window-Eyes scripting, you may be
interested in the GWToolkit's OutputDebugFile object.
>From the GWToolkit documentation:
Navigation: GW Micro App Toolkit<gwtk_introduction.htm> >
Objects<gwtk_objects.htm> >
OutputDebugFile
[Previous page]<obj_messagebox_methods_show.htm>[Return
to chapter overview]<gwtk_objects.htm>[Next
page]<obj_outputdebugfile_properties.htm>
The OutputDebugFile object provides an easy way to store debug output to a file
when a debugger is not available or when using
OutputDebugString is not convenient.
Example 1
' This example creates an ASCII text file called c:\log.txt. Each call to Write
appends text to the file.
Set OutputDebugFile =
SharedObjects("com.GWMicro.GWToolkit.OutputDebugFile").NewFile
OutputDebugFile.FileName = "c:\log.txt"
OutputDebugFile.Write "This is a test"
OutputDebugFile.Write "This is another test"
Example 2
' This example creates a Unicode text file called c:\log.txt. Each call to
Write overwrites the file.
Set OutputDebugFile =
SharedObjects("com.GWMicro.GWToolkit.OutputDebugFile").NewFile
OutputDebugFile.FileName = "c:\log.txt"
OutputDebugFile.InputOutputMode = OutputDebugFile.ioWrite ' overwrite the
existing file
OutputDebugFile.FileFormat = OutputDebugFile.ffUnicode ' create Unicode file
OutputDebugFile.Write "This is a test"
On 3/19/2015 5:34 AM, Rick Thomas via Scripting wrote:
I want to create a method to append lines to a text file:
The first code I pulled from google:
To create a simple log file for debugging Aarons script:
DIM logFSO, logFile
Set logFSO = CreateObject("Scripting.FileSystemObject")
Set logFile = logFSO.CreateTextFile( "c:\VSScriptLog.txt", True)
[Above just goes high in the script to be executed once when loaded]
logFile.WriteLine("Logged ok")
[Above goes wherever i want to print a line to the log]
logFile.Close
[Where do I put the close for the file in a script so it closes when the
script is done]
Or with the file options can i just have a method:
High in code:
DIM logFSO, logFile
Set logFSO = CreateObject("Scripting.FileSystemObject")
Then:
in a print Sub:
Set logFile = logFSO.CreateTextFile( "c:\VSScriptLog.txt", True)
logFile.WriteLine("Logged ok")
logFile.Close
End Sub
I want to just append lines to a text file upon a WriteLine method of the
fso object for debugging.
Rick USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150319/530eede4/attachment.htm><http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150319/530eede4/attachment.htm>
_______________________________________________
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of Ai Squared.
For membership options, visit
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/sclower%40aisquared.com.
For subscription options, visit
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150319/37b24b63/attachment.htm>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150319/37b24b63/attachment-0001.htm>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com/attachments/20150319/37b24b63/attachment-0002.htm>
_______________________________________________
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of Ai Squared.
For membership options, visit
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com.
For subscription options, visit
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com