HTMLDump plugin for Take Command / TCC / 4NT

Version 1.1.0     2014-10-29

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. (I don't recommend doing this, as HTMLDUMP is a specialized plugin unlikely to be used very often.)

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames 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 /C /D /K:class /N /O /P /Q /S:style /T:title /U /W /X:cssfile filename

/Cformat output as <CODE>
/Pformat output as <PRE> (the default)
/Ddo not save color info
/K:classspecify CSS class name for the <PRE> or <CODE> tag
/Ndump a table only, no HTML head or body
/Oopen the output file
/Qquietly; no message to the console
/S:stylespecify CSS style info for the <PRE> or <CODE> tag
/T:titlespecify a title for the page; the default is “Console Dump” followed by the date and time
/Uoutput UTF-16
/Woutput Windows-1252
/X:cssfilespecify 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.

/C and /P select alternate ways of formatting the console text (using <CODE> tags or <PRE> tags.) /P is the default; /C creates larger files.

Any class specified with /K, and/or style specified with /S, will be applied to the <PRE> or <CODE> tag. Remember to double any percent signs in the style spec. HTMLDUMP does not define any classes, so /K will have no actual effect unless an external style sheet is specified via /X or the resulting file is edited.

If /N is specified, the output will contain only a table, not an HTML header and body. The resulting file will not be a valid web page. This option may 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 not work correctly if filename is CLIP:.

/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.

Note that 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.



_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 is 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.0.52011-12-14Fixed 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.
1.0.62013-04-17Fix for nulls appearing in UTF-8 output; upgraded project to Visual Studio 2010.
1.0.72014-02-25Added /Q.
1.1.02014-10-29Changes for TCC v17 compatibility.

Status and Licensing:

This plugin is © Copyright 2014, Charles Dye. Unaltered copies of the binary and documentation files may be freely redistributed without restriction. I make no guarantee and give no warranty for its operation.

If you find a problem with this plugin, 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.