PopupFix plugin for TCC and TCC/LE
Version 1.3.0 2014-10-29
Charles Dye
Purpose:
This plugin is intended to solve problems with popup windows in TCC, particularly in the Console2 tabbed console wrapper. If PgUp doesn’t work in TCC under Console2, installing PopupFix may fix the problem. If you are not having issues with invisible popup windows, this plugin serves no purpose.
PopupFix waits for TCC to create a command history, directory history, or filename completion window, or a system dialog box. When one of these popup windows appears, PopupFix tries to fix problems that would render it invisible: appearing off-screen or popping up underneath other windows.
Installation:
To use this plugin, copy PopupFix.dll to
some known location on your hard drive. (If you are using the 64-bit
version of TCC, take PopupFix-x64.dll instead of
PopupFix.dll.) Load the file with a
PLUGIN /L
command, for example:
plugin /l c:\bin\tcmd\test\popupfix.dll
If you copy this file to a subdirectory named PlugIns within your TCC program directory, the plugin will be loaded automatically when TCC starts.
Plugin Features:
New internal variables: _CONEMU
,
_CONSOLE2
, _TCMDTAB
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. |
New Command:
POPUPFIX
— Displays or changes
plugin options.
Syntax:
POPUPFIX
/C:
center /D /F:
focus /L:
load /R /S
/C: center | center popup windows (N) |
/D | restore the original plugin defaults |
/F: focus | reset focus when a dialog is closed (Console2) |
/L: load | load plugin only if Console2 is detected (No) |
/R | restore default options from the registry |
/S | save the current options to the registry as the new defaults |
All options may be combined except for /D
and /R
.
If you specify multiple options, they are applied in this order:
- The original (
/D
) or saved (/R
) defaults are restored. - Any changes made with
/C:
,/F:
, or/L:
are applied. - If
/S
was specified, the new settings are saved to the registry.
/C:
The default behavior is to center only popups which appear
off the visible screen. If you set center to
A
, PopupFix will center all popup windows which it
discovers. If center is W
, PopupFix
will instead try to move the popup window alongside the main window; if that
fails (because there isn’t enough room near the main window), the plugin
will either center the popup (if it’s off-screen) or leave it alone (if
it’s already on-screen). The default is N
, to center as
needed. This option may be useful if popups appear far away from the main
window, e.g. on the wrong monitor in a multi-monitor system.
/F:
Enable this option if you have problems with the focus
being moved to unrelated programs after you close a TCC dialog. Possible
values are Never
, Always
, or Console2
(reset focus only when running in Console2). Only the first letter is
significant; the default is Console2
.
/L:
If you set this option to Yes
, the plugin
will not load unless it detects the Console2 terminal emulator. The default is
No
.
/R:
If you use /R
to reset the plugin to the
user’s defaults, default values will be read from the registry only. Any
POPUPFIX_* environment variables will be ignored.
New Internal Variables:
_CONEMU
— ConEmu terminal
emulator status.
If TCC is running in ConEmu-Maximus5,
this variable returns a nonzero value. If ConEmu is not detected, it returns
0
.
_CONSOLE2
— Console2
terminal emulator status.
If the plugin has found that TCC is running in
Console2,
this variable returns a nonzero value. If Console2 was not detected, it returns 0
.
_TCMDTAB
— Take Command tab
status.
If TCC is running in a Take Command tab window, this variable returns a
nonzero value. If Take Command was not detected, it returns 0
.
Registry Use:
PopupFix looks for default options in these locations when it starts up, in this order:
- Environment variables
- Registry key HKEY_CURRENT_USER\Software\JPPlugins\PopupFix
- Registry key HKEY_LOCAL_MACHINE\Software\JPPlugins\PopupFix
Environment variables override registry values; HKEY_CURRENT_USER trumps HKEY_LOCAL_MACHINE. The values the plugin looks for are:
Environment variable: | Registry entry: | Type: | Usage: | Default: |
PopupFix_Always_Center | AlwaysCenter | DWORD | 0 as needed, 1 always, 2 beside window | 0 |
PopupFix_Restore_Focus | RestoreFocus | DWORD | 0 never, 1 always, 2 Console2 only | 2 |
PopupFix_Console2_Only | Console2Only | DWORD | 0 no, else yes | 0 |
POPUPFIX /S
saves settings only to
HKEY_CURRENT_USER, not to HKEY_LOCAL_MACHINE.
If you set the Console2-only option with POPUPFIX /L:YES /S
and
you don’t have Console2 installed, changing the setting back may seem like
a puzzle — you can’t use the POPUPFIX
command
without loading the plugin, and you can’t load the plugin without changing
the saved options! One way to solve the problem is to override the registry
value with an environment variable:
set popupfix_console2_only=0
plugin /l popupfix.dll
popupfix /s
unset popupfix_console2_only
Another solution would be to remove or zero the offending registry entry with RegEdit, or with a command like:
echo %@regset[hkcu\software\jpplugins\popupfix\console2only,reg_dword,0]
Popup Windows:
Some of the popup windows and dialog boxes that this plugin will force to the front, and possibly move:
Function: | Type: | Key or Command: |
Command history | Popup | PgUp or PgDn keys |
Directory history | Popup | Ctrl-PgUp or F6 keys |
Filename completion | Popup | F7 key |
Extended directory search | Popup | CD , CDD , PUSHD , etc. |
Text line selection | Popup | @SELECT function |
TCC configuration | Dialog | OPTION command |
LIST open filename | Dialog | LIST command |
LIST find text | Dialog | F or Ctrl-F keys in LIST |
LIST goto line number | Dialog | G key in LIST |
Command assistance | Dialogs | many commands |
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:
v1.0.0 | 2013-04-24 | initial release |
v1.0.1 | 2013-04-27 | minor cosmetic fix |
v1.0.2 | 2013-05-02 | fix for TCC occasionally un-hiding its window after Console2 has hidden it |
v1.0.3 | 2013-05-15 | ghastly workaround for console windows STARTed from a Console2 tab being misidentified as belonging to Console2 (and automatically hidden) |
v1.0.4 | 2013-05-16 | improved Console2 detection |
v1.1.0 | 2013-05-22 | reworked /C:
to have three values |
v1.2.0 | 2013-06-17 | tweaks to window-offscreen detection |
v1.2.1 | 2013-09-23 | fix for problem with focus resetting when popups are opened and closed in quick succession |
v1.2.2 | 2014-07-31 | recognize Take Command 16+ main window (“XTPMainFrame” class) |
v1.3.0 | 2014-10-23 | changes for TCC v17 compatibility |
Status and Licensing:
This software is copyright © 2014, Charles Dye.
The binaries and documentation for this plugin may be freely redistributed 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/popupfix.zip or ftp://prospero.unm.edu/popupfix.zip.