Edit Report Templates

Introduction
Report Template
Destination File
Header & Footer Mask
File Line Mask
Buttons
Specifiers

This dialog is available from the "File > Report" menu and from the toolbar.  Use it to turn your FAR file list into a text report or DOS batch file.  You can also save each report setup (called a template) and use it again later.

Introduction

If you ever used the XTree program you may remember the Alt+B Batch command, where you specified a output filename and a line mask. This is the same type of thing. 

  1. Drop files you want to report into the FAR File List.
  2. Open this dialog.
  3. Enter a Destination Filename to save the report to.
  4. Enter a File Mask. Each file reported will use this mask.
  5. Enter a Header & Footer Mask if required.
  6. Click the "Create Report" button to generate the report.
  7. To save your report set up permanently, enter a template name and press Save.
Before you open this dialog, sort the FAR File List into the required order. To do this click the column headings at the top of the FAR File list.

Report Template

 Several default templates are supplied with FAR. These can be modified. However, If you try to delete them they will reappear next time the dialog is opened.

Destination File

Enter the name of the file to save the report to. Normally a .txt file although this could also be a .bat file (if creating a DOS batch file) or .csv file (if creating a comma delimited data file to import into MS Excel)... and so on.

Click the [...] button to browse for a file.

Header & Footer Mask

Headers and Footers allow you to specify information to appear top and bottom of a report.

To insert a file specifier in the header or footer Mask fields:

  1. Position the cursor at the required insert point.
  2. Click the [ V ] button to the right of the entry field and select a specifier.

Tip: Use the || specifier to break the line thus creating a multi-line Header or Footer.
Clear the header or footer edit fields to specify no header or footer in the report.

Note: Very long masks can stored and read from file: See @file: and @fileCRLF: commands

File Line Mask

Specify what info to write for each file.  The simplest specifier is %fpath%. The report engine expands this to the full file path for every file in the FAR File List. 

To insert a file specifier in the File Mask field

  1. Position the cursor at the required insert point.
  2. Click the [ V ] button to the right of the entry field and select a specifier.

You can also type in your own text around the specifiers.

Note: Very long masks can stored and read from file: See @file: and @fileCRLF: commands

Example Line Mask:

For filename = c:\files\file1.htm
the following line mask:

   Copy "%fpath%"  "%fdir%\%fname%.html".

Will expand to:

   Copy "c:\files\file1.htm"  "c:\files\file1.html"

All Uppercase / Lowercase Results

Specifiers that are all uppercase will expand to an all uppercase result.

    Example: %FPATH% is replaced by C:\FILES\FILE1.HTM

    Note that all letters in the specifier are uppercase.

Specifiers that are all uppercase, except for the last A..Z character, will expand to an all lowercase result.

    Example: %FPATh% is replaced by c:\files\file1.htm

    Note that all letters are uppercase except for the last letter "h".

More Examples:

    For filename = C:\Files\Bakup\file1.htm


Buttons
Report Files Group Select the required file filter. Select "HTML Files" to only report on HTML files found in the FAR File List. Select "Selected Files" to only report on selected items in the FAR File List.
Create Report Generate the report file. Once created the file is displayed in the text file viewer (as specified in Options > Preferences dialog). This does not save the current settings. You must press the "Save" button to save your settings.
Close Close the dialog.
Help Displays this help.

Notes on some selected specifiers:
%fvers% Using this specifier will slow down reporting, since FAR must open each file and read the file version information. Note that not all files contain version information - Many exe, dll, ocx, vxd, bpl files do. Microsoft system files normally do.
%fdatetime:format% Displays the files 'last modified' date & time in any given format according to the format string.
eg. %fdatetime:d/m/y h:m am/pm%.
%relpath% This is the file path relative to the base folder (%basedir%) which is the folder you opened with FAR.  Also note: %fpath% = %basedir%\%relpath%
Tip: The base folder path can be seen in the FAR title bar in the main window.
%colrepl% Displays the number in the "Replacements" Column of the FAR file list.
%colmatch% Displays the number in the "Matches" Column of the FAR file list.
%dirseg:n% Displays directory segment n (1..99) of the current file path.
EG. If file path = "c:\seg1\seg2\file.htm" then %dirseg:1% will display "seg1". %dirseg:3% displays nothing (empty string) since there is no directory segment 3.
%inc% Displays a number 1..n that increments with each usage (typically with each line).
%inc:n% Same as %inc% but n is an offset. EG. %inc:2000% creates numbers 2001..2000+n
%inc:n:w% Same as %inc:n% but w is a minimum field width. EG. %inc:-1:3% creates numbers 000, 001, 003...
%inc:n:w:ch% Same as %inc:n:w% but ch is the char to pad with. EG. %inc:-1:3:*% creates numbers **0, **1, **3...
%tab% Use %tab% to attempt to line up columns of text.
Moves the cursor out to the next tab position.
Example: "%fdate% %tab% %ftime%"  will cause all file date & times to line up even though some file dates may vary slightly in length. Tab ASCII code is #09.
%pad:n% Use pad to attempt to line up columns of text.
Example: "%fpath% %pad:66% %fdate%"
This will write the file path - if the output string is less than 66 chars it will be padded to 66 chars using space chars before adding the file date string.
%*:format% Special file commands used to scrap ASCII files. See Special Specifier.
@file:filepath
@fileCRLF:filepath
If your line mask is very long you can define your mask in a separate text file. No other commands can be mixed with this command.
eg. @file:c:\path\myfile.txt -- When you click "Create Report" the contents of the file c:\path\myfile.txt is read and used as the Line Mask. In this command all line feeds are ignored. The @fileCRLF:c:\path\myfile.txt command is similar except CRs and LFs are kept and converted to '||' preserving the line feeds.
|| Use "||" to break to a new line.  If used with %pad:n" then note that the pad value n in %pad:n% is the number of characters from the start of a new line.
%fHtmlTitle% FAR opens HTML files only and extracts the file title. The file title is normally specified in the <header> section between the <title> and </title> tags. If a title is not found or the file is not an HTML file then an empty string is displayed. For non-HTML files a title may be provided in a matching .Meta proxy file (see below).
%fHtmlMeta:xxx:default% FAR opens HTML files only and extracts meta data "yyy" matching name="xxx". Meta data should be in the form <meta name="xxx" content="yyy">. Optionally specify a default string to return if the data is not found in the HTML file.
EG. %fHtmlMeta:GENERATOR%  -- An HTML file containing a meta statement <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> will display "Microsoft FrontPage 6.0" otherwise an empty string is displayed.
EG. %fHtmlMeta:GENERATOR:Dogs & Cats%  -- Same above but if the Meta statement is not found the string "Dogs & Cats" is displayed instead of an empty string.

Meta Proxy file: FAR allows you to use a proxy file to hold HTML Meta data for a non-HTML file. EG. If FAR finds the non-HTML file "fred.pdf" it looks for a file "fred.pdf.meta" (ie. same name with .meta file extension) and tried to extract the Meta info from that file. The .meta file is simply a renamed HTML file containing Title and Meta info.


http://www.HelpwareGroup.com/