|
APGen Object Reference |
|
See Also: |
The Output object encapsulates an output stream or file. Generated content is sent through the Output object, to this stream or file.
| Class | String | Returns the class of the output stream. |
| Filename | String | Sets/returns the filename of the output file. |
| Dir | String | Sets/returns the directory containing the output file. |
| Path | String | Sets/returns the complete path to the output file. |
| Append | True/False | Sets/returns whether or not new text is appended to the end of an existing output file. The default value is False. |
| Unicode | True/False | Sets/returns whether text is written in Unicode or ANSI file format. The default value is False (ANSI/MBCS). |
| Logon | Logon object | Returns a Logon object that can be used to set the default logon for opening/creating the output file. |
| Stream | IStream | Sets/returns the IStream object that receives output. |
| CanCreateDirs | True/False | Sets/returns whether new directories will be created if needed. |
| Buffer | True/False | Sets/returns whether output is buffered. |
| WriteIffChanged | True/False | Sets/returns whether the output file is overwritten only when its contents change. |
| BufferContents | String | Sets/returns the contents of the output buffer. Requires
Output.Buffer to be True.
|
| LastModified | Date/Time | Returns the date/time the output file was last modified. |
| Write() | Appends a value or string to the output stream. |
| BinaryWrite() | Writes data to the output stream without any character-set conversion. |
| ClearBuffer() | Clears the output buffer. |
| FlushBuffer() | Flushes the output buffer to the output stream. |
| Open() | Opens the output file. |
| Close() | Closes the output stream. |
The Output object encapsulates an output stream. Streams are opened by calling Output.Open() or by setting the Output.Stream property. Output.Open() creates local and network files. Output.Stream is part of APGen's Pluggable Streams architecture, which allows APGen to send output to any custom object that implements the COM IStream interface.
The output file path is specified using the Filename, Dir, and Path properties. These properties determine the path of the file created by Output.Open(). The action taken by Output.Open() is also affected by the Append, Logon, and CanCreateDirs settings.
The properties Filename, Dir, Path, Append, Logon, CanCreateDirs, WriteIffChanged, and LastModified have no effect when Output.Stream is used to connect to a user-defined stream.
The Buffer and Unicode properties are valid for all output streams, whether they are opened with Output.Open() or by setting Output.Stream.
Generated content is sent to the output stream. Executing any of these will generate content:
Output.Open() can be used to open the output file. However, it isn't necessary to explicitly call Output.Open(). Output.Open() is implicitly called when the following conditions are met:
Output.Close() can be used to explicitly close the output stream. After the stream is closed, generating content will re-open the output stream. Changing the output file path implicitly closes the old output stream.
An example that creates multiple output files from a single APG script:
<%#
Output.Filename = "file1.txt"
Output.Write "Contents of file1.txt"
' Changing the Filename value closes the old output stream
Output.Filename = "file2.txt"
Output.Write "Contents of file2.txt"
#%>
To use the Output object in C++, see the IAPGOutput interface in <install dir>\include\APGen.h.