|
Output Object |
|
See Also: |
The Output.Append property sets/returns whether content should be appended to the end of the output file.
VBScript:
JScript:
| boolVal | True: If the output file already exists, add new content to the end of the file. False (Default): Overwrite any existing file. |
If Append is True, APGen seeks to the end of the file before writing new content.
If the Append property is False when Output.Open() is called, a new file is created. If Append is True when Output.Open() is called, and a file can be found with path Output.Path, the existing file is opened, and new content is added to the end of the file. If no file can be found with path Output.Path, a new file is created.
If Append is True when content is written to the output stream, APGen seeks to the end of the stream before writing the content. Under normal circumstances, this does not change the behavior of writing content to the output stream. When the output file is being written to by more than one APG script or application, this keeps APGen from overwriting content that another script or application has written.
The following example adds entries to a text file, then displays the file. Since Append is set to True, old entries are saved in the file.
<%#
Option Explicit
Output.Filename="names.txt"
Output.Append = True
Dim strName
Do
strName = InputBox("Enter a name. Click cancel to stop.")
If (strName = "") Then
Exit Do
End If
' Write the name to the output file
Output.Write strName & vbCRLF
Loop
' Windows Scripting Host must be installed
' in order to create this object
Dim objShell
Set objShell = CreateObject("Wscript.Shell")
' View the names.txt file
objShell.Run Output.Path
#%>