LinkedTab_AutoClose_Handler: Auto-close linked tabs

Note: This script now requires a minimum Opus version 11.16...

This script was written as part of another request described in the following discussion:

DO11: Script to open/close related folder tabs automatically

...but I thought that just this piece of that idea might be of interest to others on it's own.

What does it do?:
This script handles the OnCloseTab event so that when a tab that is linked to another tab is closed by the user, the linked tab is also closed automatically... By default, the behavior is enabled without any customization needing to be made, however the script also allows a qualifier key to be set in the scripts configuration options in Prefs. Only shift, lwin and rwin qual keys are supported, since Opus hard codes alt and ctrl key behavior when clicking on tabs.

How to install and use it?:
The script is provided here as an Opus Script Package... which in turn is actually a zip file with a VBScript packaged inside. It can be installed by either manually copying the OSP file to the /dopusdata\Script AddIns folder, or via drag-and-drop into the Preferences / Toolbars / Scripts page.

Download: LinkedTab_AutoClose_Handler.osp (2.07 KB)
Notes:
2014-03-28: Initial release...
2014-12-29: v1.2.0 - Script renamed to match my new standard, added support for a new QualKey_Disable option to disable script execution, renamed some options, added environment variable based script control, and minimum required Opus version is now set to 11.16
2016-11-22: v1.2.2 - Minor update to change some logging messages. No functional changes...


After installing the script package, it should just work - but you can also set qualifier keys that can both enable and disable the scripts execution. This can be done via the scripts Configuration dialog. The default setting is "none" which for this script means that any way of closing the tab will trigger the script (whether qualifier keys are held or not).


In addition to the qualifier keys that can be set to enable/disable the scripts execution (qualifier keys require the Always_On option to be set to True), script execution can also be enabled by the use of an Opus environment variable called linkedtab_autoclose.

Here is a sample toolbar button that toggles the lister scoped variable (the script supports tab, lister or global scoped variables) which you can copy and paste directly to your toolbar:

<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>LinkedTab_AutoClose</label>
	<icon1>#closetab</icon1>
	<function type="normal">
		<instruction>@toggle:if $lst:linkedtab_autoclose</instruction>
		<instruction />
		<instruction>@ifset:$lst:linkedtab_autoclose</instruction>
		<instruction>@set lst:linkedtab_autoclose</instruction>
		<instruction />
		<instruction>@ifset:else</instruction>
		<instruction>@set lst:linkedtab_autoclose=true</instruction>
	</function>
</button>

...Feedback welcome.

Good work, thank you

Root post updated with a minor update...

Root post updated again with sample toolbar button for the environment variable based script control...

Root post updated with a trivial update which adjusted some logging, no functional changes.