PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: WhiteSpace[Next]: #OutputHold
\ -> Commands -> #output

#output

In most situations you would read one or more input files to generate a single output file. There are situations where you'd like more control so that you can generate multiple files.

You can nest to any level as only one output file is open at any time so file resources are not wasted. There is a "HOOK_OUTPUT" hook which you may require for more complex logic.

You may wish to have a look at the "FileMake" tip for a way of optionally overwriting an existing file (only if there are "significant" changes).

Syntax

[WhiteSpace]#output  ["]OutputName["]  [AsIs] [Append] [NoHeader] [HTML|REXX|POWERSHELL|OTHER] [Hold]

If "AsIs" was specified then the "OutputName" specifies the name of the output file otherwise the value is passed through the output specification provided with the "/Output" switch. If the "OutputName" parameter is not specified at all then the previous output file is restored.

Note that files specified for use "AsIs" do not have their case adjusted as specified on the /FileNames switch, if you require the case to be adjusted you will need to make use of the EnsureFileHasCorrectCase routine.

If "Append" was specified then the output file is not deleted if it already exists.

If "NoHeader" was specified then if the file would normally have an output header then this is disabled (see /OutHeader).

In some circumstances you may wish to generate a new file in a different processing mode to the current one, if this applies to you then choose one of "HTML", "REXX" or "OTHER".

Specifying "HOLD" causes a "#OutputHold" command to be invoked internally for you, This is the only way to ensure that you capture any header information that may be automatically generated.

When a previous file is restored (no parameters) then new data is appended, otherwise the file is erased before writing the first line.

Example

Line 1 of file 1
Line 2 of file 1
#output  '2nd'
   Line 1 of file 2
   Line 2 of file 2
   #output  'c:\path\3nd.ext' AsIs
       Line 1 of file 3
   #output
   Line 3 of file 2
#output
Line 3 of file 1

Example - Relative Filenames

The following examples show how you can calculate filenames which are relative to the directory where output normally goes (as determined by the /OUTPUT switch:

;--- Macro to calculate filename relative to output directory ---------------
#evaluate ""                       ^OutputDir = EnsureFileHasCorrectCase(FilePart('location', '<?OutputFile>'))^  ;;Only need to determine once!
#define   FileRelativeToOutputDir  <??OutputDir>{$File}

;--- Test macro -------------------------------------------------------------
1. InOutput.OUT         = <$FileRelativeToOutputDir FILE="InOutput.OUT">
2. SubDir\InOutput.OUT  = <$FileRelativeToOutputDir FILE="SubDir\InOutput.OUT">
3. ..\Parents.OUT       = <$FileRelativeToOutputDir FILE="..\Parents.OUT">

Example - Dropping output

There may be times when you wish to drop some lines, for example you might be processing a file in a number of passes, this shows how you can do this under windows and OS/2:

#DependsOn TEMP "NUL"       ;;Don't add to dependancy file!
#output "NUL" ASIS APPEND   ;;Drop output!
This line gets dropped
#output                     ;;Stop dropping output!


email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: WhiteSpace[Next]: #OutputHold


PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm