PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: GenerateFileName()[Next]: GetAmPmTime()
\ -> Rexx -> Inbuilt PPWIZARD Functions -> GenerateFileName() -> Generate Mask

Generate Mask

A generate mask is used to create a new filename based on the full name of the main input file being processed.

The GenerateFileName() routine uses generate masks as do the following switches (which make use of the rexx call):

  1. /DependsOn
  2. /Output

The simplest generate mask is simply the name of a relative or absolute file such as "c:\output\new.htm" or "out\new.html". While the simplest form, it is rarely used, for example if this was used on the /Output switch then all input files would generate the same output file (each overwriting the previous output).

There are special predefined characters and strings which allow you to indicate parts of the source file that you wish to use to create the output filename. An example of this is "out\*.html" which says that the output file is to go into the directory named "out" and will have the same "base" name as the source file but with the extension ".html", so if you were building html for "tryme.it" then the html being generated would be placed into "out\tryme.html".

The following describes some case sensitive special strings and characters which can be embedded anywhere in a generate mask:

  1. *.* or {$SHORT}
    This gets replaced with the short filename (any path removed) of the current input file.

  2. * or {$BASE}
    This gets replaced with the short filename (both path and extension removed) of the current input file.

  3. {$FULL}
    This gets replaced with the full filename (with path) of the current input file.

  4. ? or {$PATH}
    This gets replaced with the path (including terminating slash) of the current input file. This is most likely to be of use if you want to position generated files relative to the input file and your mask scans subdirectories. For example "?OUT\*.HTM".

  5. {$path}
    This allows you to set up a separate tree for generated filenames, the input mask and file are examined and the relative path extracted, the result is either blank ('') or a relative path that ends with a path separator. Note for this to work the input mask must either use an absolute path, begin with '.' or '..' followed by slash or not have a path attached at all otherwise ppwizard will abort. It would be pointless to use this sort of path unless subdirectories are being scanned. You may wish to investigate the /BaseDir switch.

  6. {$OutputDir}
    This is the default output directory if one was specified (see /output) or "". This allows you to refer to a configured output directory and not hard code it.

Note that unix type operating systems will probably have problems with "$path" etc when used on the command line (to unix this means replace with the "PATH" environment variable's contents). You need to hide or escape the dollar sign, so use either "{x24}path" or "\$path" instead.

Note that resultant relative filenames are always relative to the current directory.

While you can control the case of the mask (not controlled by the special codes), you can't control the case of what the codes replace. What you can do is ensure the whole name is either in upper or lower case with the /FileNames switch or EnsureFileHasCorrectCase() call.

Generate ".html" in OUT directory #1

You wish output created in the "OUT" directory (relative to current directory):

ppwizard *.it /Output:OUT\*.html

Generate ".html" in OUT directory #2

You wish output created in the "OUT" directory (relative to input file):

ppwizard *.it /Output:{$PATH}OUT\*.html

Separate Source and Destination Trees

ppwizard +c:\src\*.it /output:c:\tmp\out\{$path}*.htm

The file "c:\src\1.it" would create "c:\tmp\out\1.htm" and "c:\src\subdir1\subdir2\1.it" would create "c:\tmp\out\subdir1\subdir2\1.htm".

You might also wish to check out the /BaseDir switch although it is not really required unless you wish to process a subtree of a larger tree which you normally process.


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

[Top][Contents][Search][Prev]: GenerateFileName()[Next]: GetAmPmTime()


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