APGen Documentation Previous Topic: Output.Class Next Topic: Output.Dir Parent Topic: Output Object    Output Object
Output.Filename
See Also:

The Output.Filename property sets/returns the filename of the output file.

Syntax

VBScript:

Output.Filename [= strFilename]

JScript:

Output.Filename [= strFilename];

Parameters

strFilename A string indicating the filename for the output file.  A relative or absolute path may be used.

Notes

When setting the Filename property, the strFilename parameter may be an absolute path, a relative path, or a filename.  For a list of valid path formats, see the documentation for the Output.Path property. 

strFilename relative paths and filenames are resolved using the Output.Dir value.  The Path value is adjusted to fit the new filename and any changes in the directory.  The Dir value will change if the directory is changed.

When reading the Filename property, no path information is returned, just the name of the file.

The Path value is a combination of the Dir value and the Filename value.  When Output.Open() is called, the Path value is used to determine the location of the output file.

The initial, default value for Output.Filename is determined using the name of the root APG script, with the file extension replaced with ".htm".  In most cases, this default value should be replaced before any content blocks or Output.Write() statements are executed.  See When to Open the Output Stream for more information.

Changing the value of the Filename property after an output stream has been opened closes the stream.  New content will be sent to the file specified by the new Filename value.

Example

The following example, hello.apg, shows proper use of the Output.Filename property:

<%#
'   Note that the Output.Filename property is set before any
'   content blocks are executed

Output.Filename = "hello.htm"
#%>

<HTML><HEAD>
<TITLE>Hello World, generated by APGen</TITLE></HEAD>

<BODY><H2>
Hello World!
</H2>
This file was generated by Active Page Generator.
</BODY></HTML>

Applies To

Output Object