ConSearch plugin for Take Command / TCC / TCC/LE

beta version 0.35.0.3     2023-10-16

Charles Dye

Purpose:

This plugin provides a quick and easy way to search for text in the console’s scrollback buffer.

Installation:

To use this plugin, copy ConSearch.dll to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take ConSearch-x86.dll instead of ConSearch.dll.) Load the plugin with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\consearch.dll

If you copy this file to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically when TCC starts.

Plugin Features:

New hotkey: Alt-F

New commands: CONSEARCH, CONSEARCHOPTS

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.

New Hotkey:

Alt-F — Opens the search dialog.

You can change the default hotkey using CONSEARCHOPTS /K:. You can also disable the hotkey with CONSEARCHOPTS /K:NONE. When the hotkey is disabled, you can still open the search dialog with the CONSEARCH command.

The Search Dialog:
Search dialog

The search dialog offers these controls:

Text:Enter the text or regular expression to search for in this field.
Search TypeChoose a case-insensitive, case-sensitive, or regular expression search.
Whole Word OnlyDon’t find strings next to letters or numbers; not used for regular-expression searches.
Wrap All LinesTreat the entire console buffer as a single, very long line.
Find PreviousSearch backwards for the text or expression.
Find NextSearch forward for the text or regular expression.
CloseDismiss the dialog.

New Commands:

CONSEARCH — Open the search dialog and search the console buffer for text.

Syntax:
CONSEARCH /A:yn /I /R  /S /W:yn text

/A:ynwrap all lines
/Icase-insensitive search
/Rregular expression search
/Scase-sensitive search
/W:ynfind whole words only
textthe text or regular expression to search for

If you supply the text, the search dialog will open and automatically search for the first instance of text in the console buffer. If you don’t supply any text, the dialog will open but the search will not begin.



CONSEARCHOPTS — Display and change the plugin settings.

Syntax:
CONSEARCHOPTS /D /E:error /F:yn /H:colors /K:key /L /R /S /T:type /W:yn

/Drestore the original plugin default settings
/E:errorset the behavior when the search string is not found:
     A — play the system “Asterisk” sound
     H — play the system “Hand” sound (default)
     D — play the system “Default Beep” sound
     E — play the system “Exclamation” sound
     M — pop up a message box
     C — close the search dialog
/F:ynfade the search dialog when inactive
/H:colorsspecify the highlight colors
/K:keyspecify a different hotkey
/Llist all supported hotkeys
/Rrestore the settings saved in the registry
/Ssave the current settings to the registry as the new defaults
/T:typespecify the default search type; type is I, R, or S
/W:ynalways try to move the search dialog near the console window
/X:ynload plugin in a Take Command tab

/D restores the original plugin default settings; /R restores the settings stored in the registry, if any. You cannot combine the two. /S saves the current settings to the registry as the new defaults; they will be used automatically the next time you load this plugin.

/L displays a list of all the hotkeys which this plugin supports. You cannot combine /L with any other option.

/K:key sets a different hotkey to pop up the search dialog. Some examples of valid hotkeys are F3, Ctrl-F, Ctrl-Alt-S, and Shift-F10. The default is Alt-F.

•  Note: Many of the hotkeys you can choose are already used by Take Command, TCC, or Windows itself. If you select a new hotkey and pressing it causes strange things to happen, try reverting to the default value of Alt-F. If that works as expected, then the hotkey you tested is already used for some other function; try a different one.

/H:color allows you to set the colors used to highlight found text. color may be an integer value (prefix 0x for hexadecimal) or a quoted string. For example, /H:0X1E or /H:"BRIGHT YELLOW ON BLUE" will cause matching text to be highlighted in bright yellow on blue. /H:0 or /H:REVERSE shows matching text in reverse video. Note that the plugin will pick different colors if the matching text has the same background color as the one you specify.

/W:yn: If this option is on, every time you open the search dialog, the plugin will try to move it alongside the console or Take Command window. (The dialog won’t be moved if there isn’t enough room for it on any side of the console window.) If this option is off, the dialog will reopen in the same place it was when it was last closed. yn is Y or N; the default is N.

/E:error sets the behavior when the search text isn’t found. The system sounds may be changed using the “Sounds” applet in Control Panel. The message-box option is annoying and I only recommend it for situations where the audio would not be noticed. Only the first letter is significant; the default value is H.

/T:type sets the default search type when the plugin is loaded. It does not affect the current instance, and has no effect unless you save the settings with /S.

/X:yn determines whether the plugin loads when it detects that it’s running in a Take Command tab window. The default is /X:Y  (load whether Take Command is detected or not). If you change this option to /X:N and save it with /S, then the plugin will not load in Take Command tab windows (it will load as usual in standalone console windows).

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

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

ConSearch is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of the plugin from http://charlesdye.net/dl/consearch.zip.