HTMLDump plugin for Take Command / TCC / TCC/LE
Version 1.2.8 2020-06-12
Charles Dye
Purpose:
This plugin provides a new command HTMLDUMP
, which saves
the contents of the console buffer to an HTML file.
Installation:
To use this plugin, copy HTMLDump.dll to
some known location on your hard drive. (If you are using the 64-bit
version of Take Command, take HTMLDump-x64.dll
instead.) Load it with a PLUGIN /L
command. For
example:
plugin /l c:\bin\tcmd\test\htmldump.dll
If you copy the .DLL file to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically by each new instance of TCC.
Syntax Note:
The syntax definitions in the following text use these conventions for clarity:
BOLD CODE | indicates text which must be typed exactly as shown. |
CODE | indicates optional text, which may be typed as shown or omitted. |
Bold italic | names a required argument; a value must be supplied. |
Regular italic | names an optional argument. |
ellipsis… | after an argument means that more than one may be given. |
Plugin Features:
HTMLDUMP
command — saves the console buffer to
a file as HTML.
Syntax:
HTMLDUMP
/BG:
color /D /H /HH /K:
class /L /N /N
bcls /O /Q /S:
style /T:
title /U /V /X:
cssfile
filename
/BG: color | specify a background color for the page |
/D | do not save color info |
/H | add a header line with the console window’s title |
/HH | add a header line with the console window’s title, the date and time |
/K: class | specify CSS class name for the <PRE> tag |
/L | line numbers |
/N | dump the console text only, no HTML head or body |
/N bcls | disable features: |
B : do not write a Byte Order Mark | |
C : disable color (same as /D ) | |
L : do not declare the local language | |
S : do not create an internal style sheet | |
/O | open the output file |
/Q | quietly; no message to the console |
/S: style | specify CSS style info for the <PRE> tag |
/T: title | specify a title for the page; the default is “Console Dump” followed by the date and time |
/U | output UTF-16 |
/V | dump only the visible region of the buffer |
/X: cssfile | specify an external style sheet |
If filename matches an existing file, then
that file will be overwritten. If filename is
not specified, or if it names a directory, then HTMLDUMP
will
attempt to generate a unique filename. Directory aliases are legal in
filename, and CLIP:
may be
specified to save to the clipboard.
/BG:
color
lets you choose the background color for the page. Color
should be a W3C color name,
not a TCC color name. You can also give a six-digit hex value prefixed with
a #
sign; e.g. /BG:#F0F8FF
instead of
/BG:ALICEBLUE
.
Any class specified with /K:
, and/or
style specified with /S:
, will be applied to the <PRE> tag.
Remember to double-quote any value containing spaces, and to double any percent
signs. /K:
will have no visible effect unless an external style
sheet is specified via /X:
or the resulting file is edited.
rem Make the text bigger:
htmldump /o /s:"font-size: 125%%;" test1.html
If /N
is specified, the output will
contain only the console text, not an HTML header and body. The resulting
file will not be a valid web page. This option might be useful when saving
to CLIP:
to paste into an existing HTML file.
/O
will open the output file in the
default web browser after the dump is completed. This option will be ignored
if the filename is CLIP:
.
/U
saves as UTF-16. This option may
cause the resulting web page to fail validation, but it should still display
properly in any common web browser.
/V
: By default, HTMLDUMP
saves the contents of the console buffer from the top of the buffer, not just
the top of the visible window. Text which has scrolled off the top of the
window, but remains in the scrollback buffer, will appear in the dump file.
Text is saved down to the current cursor position. Any text below
the cursor will not be saved. (Usually there isn’t any.) Use CLS
/C
to empty the console buffer and start over with a clean slate. If
you specify /V
then only the visible region of the console buffer
will be dumped.
/X:
adds a link to an external style
sheet. Note that HTMLDUMP
does not create this file or verify
its existence. /X:
merely inserts the appropriate reference in
the output file; providing cssfile is up to you.
rem Use an external style sheet:
htmldump /x:style.css test1.html
Style.css might be used to override the internal style sheet:
BODY { background-color: #6cd; } PRE { border: 4px solid #ee0; font-family: "Courier New", Courier, monospace; }
_HTMLDUMP
variable — contains the filename of
the last successful dump.
This variable is useful because the plugin will automatically generate a
filename if none was specified. It is empty until the HTMLDUMP
command is first used, and set to *ERROR*
if an error was
detected.
Startup Message
This plugin displays an informational line when it initializes. The
message will be suppressed in transient or pipe shells. You can disable it
for all shells by defining an environment variable named NOLOADMSG
,
for example:
set /e /u noloadmsg=1
Changes:
1.2.8 | 2020-06-12 | Removed undocumented options /J and /# .
Added the number of disk writes to the final summary. |
1.2.7 | 2020-06-09 | Added /BG and /NL . Internal changes
to make the code more maintainable. Moved all the buffered-output stuff out to a separate file. |
1.2.6 | 2020-05-27 | Fix for a hypothetical bug which never actually occurs. Removed the last vestiges of Windows-1252 support. |
1.2.5 | 2020-05-07 | Adds the console dump area (lines and columns) to the final
report. Tweak to /L : line numbers are now in the default console color. Documented the
(existing, but previously undocumented) /NS . |
1.2.4 | 2020-04-23 | Fix for colors being lost in /N mode. |
1.2.3 | 2020-04-14 | Further tweaks to make the output file smaller. Added code to
prevent splitting surrogate pairs, which could bollix UTF-16 to UTF-8 conversion. New option /H
to add a header line at the top with the console’s title. |
1.2.2 | 2020-04-12 | Creates an internal style sheet, which should produce a smaller output file for large console dumps. Removed the table; now the PRE block is embordered by CSS. |
1.2.1 | 2020-04-10 | Further tweaks, mostly for speed. Also, HTMLDump does not write to stdout until after the console buffer has been captured. |
1.2.0 | 2020-04-09 | This is pretty much a total rewrite. HTMLDump now writes HTML 5,
and supports Unicode characters outside the BMP. Removed /C and /P ; HTMLDump now
always uses a PRE tag. Removed /W , along with all Windows-1252 support. Added /L
(line numbers) and /NB (no BOM). The exit code is now 2 if errors occurred during the dump.
Reduced the plugin’s memory footprint, made the output file smaller, added much more error checking,
and generally made the whole thing less stupid. |
1.1.10 | 2017-01-05 | Added /V . |
1.1.0 | 2014-10-29 | Changes for TCC v17 compatibility. |
1.0.7 | 2014-02-25 | Added /Q . |
1.0.6 | 2013-04-17 | Fix for nulls appearing in UTF-8 output; upgraded project to Visual Studio 2010. |
1.0.5 | 2011-12-14 | Fixed issue with high-order (>127) characters in UTF-8 output;
now Unicode files get a BOM. Added /U and /W to select UTF-16 or Windows-1252
output. |
Status and Licensing:
This plugin is © Copyright 2020, Charles Dye. Unaltered copies of the binary and documentation files may be freely distributed without restriction. I make no guarantee and give no warranty for its operation. If you find a problem, you can report it in the JP Software support forum.
Download:
You can download the current version of the plugin from http://prospero.unm.edu/dl/htmldump.zip or ftp://prospero.unm.edu/htmldump.zip.