CONTENTS
INTRO
OPERATION and SETTINGS
DOWNLOADS
SET UP
Toolbar Button
Compatibility with SessionManager
KNOWN LIMITATIONS
INTRO
The following script can:
- Update the Mini Tree to include only the paths of the currently open tabs (of the current pane) and ...
- ..., additionally, expand the current location in the tree.
- Always include permanent paths, specified by the user, in the so generated Mini Tree.
- Highlight the currently open tabs (of the current pane) in the tree.
- Update the Mini Tree automatically on each location change or manually by clicking on the script's toolbar button.
Despite some known limitations (see "KNOWN LIMITATIONS" below), I find the script very useful when someone knows the folder structure. It keeps the tree lean at alomst all times, yet shows the folders of the current location and, thus, allows to hide the folders in the file list. It also helps me to keep an overview of the open tabs, since I often have many tabs open.
OPERATION and SETTINGS
Once the script is set up (see "SET UP" below), the script's behavior is primarily controlled through a Custom Toolbar Button (CTB). Left-clicking the button will run the script once. Right-clicking it pops the CTB's context menu that allows to turn on or off automatic execution. It also gives access to the script's other settings. The settings are remembered across sessions. They are the following:
- Use This Script to Update Mini Tree Structure
Possible values: [is ON] or [is OFF] (can be toggled)
When turned on, the script will immediately try to trigger an update of the Mini Tree's structure, as described in "INTRO" above, and then do so again each time it is run. Whether or not the Mini Tree gets activated, whenever it is not active already, is controlled by the next setting.
When off, the script will leave the tree as is, be it the Mini Tree or the normal tree.
- +Switch to Mini Tree if Normal Tree Is Present
Possible values: [is ON] or [is OFF] (can be toggled)
When turned on, then the Mini Tree will get activated on each structure update if it is not already active. Turning this setting on will also try to trigger an update of the Mini Tree structure immediately.
When off, the Mini Tree can only be updated if it is active. If the normal tree is active, the Mini Tree will not get activated by running the script.
- Edit Permanent Paths
Possible values: User specified paths
When clicking this entry, a dialog pops up in which paths can be entered - or existing ones edited - that should always be included in the Mini Tree generated by the script. One path per line. The paths are remembered across sessions.
The script will check the paths for existence as soon as the dialog is "OK"ed. If "wrong" paths have been entered that the script cannot find, then this is pointed out to the user in separate message boxes, one for each "wrong" path. Such paths will most likely not appear in the Mini Tree. However, this is also influenced by the setting "Tools > Configuration... > General > Controls and More > Miscellaneous > Allow zombies in the Mini Tree". (Be aware, though, that when UNticking this XY setting, XY must be restartet for the unticking to take full effect. See also viewtopic.php?f=2&t=23680.)
At least any string that is not in the format of a path at all, should normally not appear, with the exceptions of "special paths" (see below). Unfortunately, paper folders are among those strings that are not supported by the tree of XY. Because one might wonder and try to add one anyway, a special warning message will pop in case that a paper folder was entered, even if that should be rare.
"Special paths" are supported by XY's Mini Tree. That would be: "Desktop", "Documents", "Downloads", "Links", the user folder with its name, "Network", and "Recycle Bin", yet, these have to be entered with their localized language names, as far as I can tell from how it works here for me. Ofc, if your OS language is set to English, then ... , well I might have the English names wrong, so double check for yourself. I cannot think of any other "special paths" right now, besides "This PC" but that is anyway included in the tree at all times.
Still, you can try anything. If the script does not recognize it as currently available, it will pop a warning message upon "OK"ing the dialog but still save it and foreward it to the tree. The tree might then show it or not.
An interesting application of ths is to untick "Allow zombies in the Mini Tree" (see above), add all possible drive letters to the script's "permanent paths", and call the script also from the CEA "Drive added or removed". Thus, e.g. any USB drive will automatically be added to the Mini Tree, when it's available, and hidden, when it's disconnected.
- Use This Script to ICF-Highlight Current Tabs in Tree
Possible values: [is ON] or [is OFF] (can be toggled)
When turned on, the script will immediately try to trigger an update of the script's highlighting in the tree with the use of Instant Color Filters (ICFs) and then do so again each time it is run. Whether or not any existing ICF-highlighting is replaced, is controlled by the next setting.
When off, there will be no highlighting by the script. If some other highlighting is activated, it is left untouched.
The colors can be customized in the 3rd line of the script's code. The factory settings are white text on green background.
Highlighting can also be toggled on and off by using the Instant Color Filter's toolbar button, however this does not change any of the scripts behavior when being run.
- +Overwrite Other ICF-Highlighting if Present
Possible values: [is ON] or [is OFF] (can be toggled)
When turned on, the script will overwrite any existing ICF-highlighting that might be present. Turning this setting on will also try to trigger an update of the script's highlighting immediately.
When off, the script only updates the highlighting when no other ICF-highlighting is present. If other highlighting is present, it must first be toggled off, so that the script can take effect again.
- Automatic Updating
Possible values: [is ON] or [is OFF] (can be toggled)
When turned on, the script will run once immediately and then each time that a location change or pane switch occurs.
When off, the script will not run automatically.
As mentioned above, the script can always be run manually by left-clicking the script's toolbar button, regardless of the automatic behavior. Being able to run the script manually can sometimes be helpful, since it is not possible for the automatic behavior to work all the time (see "KNOWN LIMITATIONS" below). Some people might also prefer to generally turn automatic behavior off and run the script only by hand.
- Location CEAs
Possible values: [are ON] or [are OFF] (can be toggled)
The context menu of the script's CTB finally shows an extra option to turn XYplorer's "Changing Locations" Custom Event Actions (CEAs) on and off all together. This option is only meant for people who know what this is doing. Under normal conditions, this setting should always be kept on.
DOWNLOADS
Here you can download the script file and/or copy the code.
Attention! Major Changes! Both the script's name and the setup process slightly changed in version 6. It is recommended that upgraders go through the setup process again. Besides, also the script's operation and behavior changed a bit. E.g., some hard coded "smartness" has been turned into settings.
old versions: (change "log" below throughout the posts of this thread)
Code of the Script
Code: Select all
// MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted; version: 9; date: 211028
function _getColorfilterColors() {
return "FFFFFF,70B926"; // text color, background color for highlighting tabs' folders in tree: RRGGBB style
}
function _getScriptName($returnShort = 0) {
$scriptName = "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted";
$scriptNameShort = "MiniTreeWithOpenTabs";
return $returnShort ? $scriptNameShort : $scriptName;
}
"main"
// Version compatibility check
$minver = "22.40.0001";
end (<xyver> < $minver), _getScriptName() . " requires at least XY version """ . $minver . """.<crlf 2>However, the current XY version is ""<xyver>"".";
if (tab("get", "mode") == 1 or tab("get", "mode") == 6 or substr(tab("get", "data"), 0, strlen("paper:")) == "paper:") {
end 1;
}
_readINI_UseMiniTree_toPermIfNotSet();
_readINI_UseMiniTreeWhenMaxiTree_toPermIfNotSet();
_readINI_UseHighlightingInTree_toPermIfNotSet();
_readINI_UseHighlightingInTreeWhenOtherICF_toPermIfNotSet();
_readINI_UseAutoUpdate_toPermIfNotSet();
if (get("Trigger", "context") == 2 or $p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate) { // get("Trigger", "context") == 2 = script triggered by CTB
if (_conditionally_updateMiniTreeToOpenTabsAndCurrentSubfolders()) {
status "MiniTree updated";
}
_conditionally_updateICFInTreeForOpenTabs(_getColorfilterColors());
}
function _conditionally_updateMiniTreeToOpenTabsAndCurrentSubfolders() {
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTree == 1) {
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree == 1) {
_updateMiniTreeToOpenTabsAndCurrentSubfolders();
return 1;
} elseif (get("#489") == 1) { // #489 = Mini Tree
_updateMiniTreeToOpenTabsAndCurrentSubfolders();
return 1;
}
}
return 0;
}
function _updateMiniTreeToOpenTabsAndCurrentSubfolders() {
if (tab("get", "count") == 1) {
$curpathAsIs = get("Tabs");
} else {
$lengthCurTabPath = strpos(get("Tabs_sf"), "|");
$curpathAsIs = substr(get("Tabs_sf"), 0, $lengthCurTabPath);
}
$curSubfolders = (exists($curpathAsIs) == 2) ? (listfolder($curpathAsIs, , 2 + 64)) : "";
$curSubfolders = $curSubfolders ? ("|" . $curSubfolders) : "";
$inactiveTabPathsAsIs = ((tab("get", "count") == 1) ? "" : ("|" . substr(get("Tabs_sf"), $lengthCurTabPath + 1)));
_readINI_PermanentPathsInMiniTree_toPermIfNotSet();
loadtree $curpathAsIs . $curSubfolders . $inactiveTabPathsAsIs . "|" . $p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree, 0;
}
function _conditionally_updateICFInTreeForOpenTabs($colorfilterColors) {
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree == 1) {
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF == 1) {
_updateICFInTreeForOpenTabs($colorfilterColors);
return 1;
} elseif (substr(colorfilter(), 0, strlen('"autocart_MiniTreeWithOpenTabs" ')) == '"autocart_MiniTreeWithOpenTabs" ' or colorfilter() == "") {
_updateICFInTreeForOpenTabs($colorfilterColors);
return 1;
}
}
return 0;
}
function _updateICFInTreeForOpenTabs($colorfilterColors) {
$instantColorfilterDefinition = '"autocart_MiniTreeWithOpenTabs" ';
foreach($path, get("Tabs")) {
$filterPath = (regexmatches($path, "(:|\\)")) ? quote($path . "\") : quote($path);
$instantColorfilterDefinition .= "T:dir:" . $filterPath . ">" . $colorfilterColors . "||";
}
if (colorfilter() != $instantColorfilterDefinition) {
colorfilter($instantColorfilterDefinition);
}
}
"Toggle UseMiniTree"
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTree == 1) {
setkey 0, "UseMiniTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTree = 0;
} else {
setkey 1, "UseMiniTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTree = 1;
if (_conditionally_updateMiniTreeToOpenTabsAndCurrentSubfolders()) {
status "MiniTree updated";
}
}
"Toggle UseMiniTreeWhenMaxiTree"
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree == 1) {
setkey 0, "UseMiniTreeWhenMaxiTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree = 0;
} else {
setkey 1, "UseMiniTreeWhenMaxiTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree = 1;
if (_conditionally_updateMiniTreeToOpenTabsAndCurrentSubfolders()) {
status "MiniTree updated";
}
}
"Toggle UseHighlightingInTree"
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree == 1) {
setkey 0, "UseHighlightingInTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree = 0;
if (substr(colorfilter(), 0, strlen('"autocart_MiniTreeWithOpenTabs" ')) == '"autocart_MiniTreeWithOpenTabs" ') {
colorfilter("");
}
} else {
setkey 1, "UseHighlightingInTree", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree = 1;
_conditionally_updateICFInTreeForOpenTabs(_getColorfilterColors());
}
"Toggle UseHighlightingInTreeWhenOtherICF"
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF == 1) {
setkey 0, "UseHighlightingInTreeWhenOtherICF", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF = 0;
} else {
setkey 1, "UseHighlightingInTreeWhenOtherICF", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF = 1;
// if (colorfilter() != "") {
_conditionally_updateICFInTreeForOpenTabs(_getColorfilterColors());
// }
}
"Toggle UseAutoUpdate"
if ($p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate == 1) {
setkey 0, "UseAutoUpdate", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate = 0;
} else {
setkey 1, "UseAutoUpdate", "INI", self("file");
perm $p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate = 1;
load "*", "main";
}
"Toggle location CEAs"
if (tweak("SkipBrowseEvents") == 1) {
tweak("SkipBrowseEvents", 0);
} else {
tweak("SkipBrowseEvents", 1);
}
"Edit PermanentPathsInMiniTree"
_readINI_PermanentPathsInMiniTree_toPermIfNotSet();
$defaultInput = replacelist(trim($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree, "|"), "|", "<crlf>");
$returnInput = input(_getScriptName("short") . " - Edit Permanent Paths", "Edit the Permanent Paths that should always be included in the Mini Tree generated by this script. One path per line.", $defaultInput, w, 0);
if ($returnInput != 0) {
foreach($path, $returnInput, "<crlf>") {
$resolvedpath = resolvepath($path);
if (substr($path, 0, strlen("paper:")) == "paper:") {
if (exists($path) == 2) {
msg _getScriptName("short") . "<crlf><crlf>The path<crlf>""" . $path . """<crlf>points to an existing paper folder! However, paper folders are not supported in the tree. The path will be safed but will not appear in the Mini Tree. You may want to check it again.";
} else {
msg _getScriptName("short") . "<crlf><crlf>The path<crlf>""" . $path . """<crlf>points to a non-existent paper folder! However, even if it were created later on, paper folders are not supported in the tree. The path will be safed but will not appear in the Mini Tree. You may want to check it again.";
}
} elseif ($path and not (exists($path) == 2 or ($resolvedpath == $path and strpos($path, ":") == -1))) {
msg _getScriptName("short") . "<crlf><crlf>The path<crlf>""" . $path . """<crlf>can not be verified to exist! The path will be safed but might not appear in the Mini Tree. You may want to check it again.";
}
}
$returnInput = trim(replacelist($returnInput, "<crlf>,<crlf><crlf>", "|", ","), " |");
setkey $returnInput, "PermanentPathsInMiniTree", "INI", self("file"), 1;
$p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree = $returnInput;
load "*", "main";
}
"Read INI UseMiniTree to Perm if not set"
_readINI_UseMiniTree_toPermIfNotSet();
"Read INI UseMiniTreeWhenMaxiTree to Perm if not set"
_readINI_UseMiniTreeWhenMaxiTree_toPermIfNotSet();
"Read INI UseHighlightingInTree to Perm if not set"
_readINI_UseHighlightingInTree_toPermIfNotSet();
"Read INI UseHighlightingInTreeWhenOtherICF to Perm if not set"
_readINI_UseHighlightingInTreeWhenOtherICF_toPermIfNotSet();
"Read INI UseAutoUpdate to Perm if not set"
_readINI_UseAutoUpdate_toPermIfNotSet();
"Read INI PermanentPathsInMiniTree to Perm if not set"
_readINI_PermanentPathsInMiniTree_toPermIfNotSet();
function _readINI_UseMiniTree_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_UseMiniTree))
{
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTree = getkey("UseMiniTree", "INI", self("file"));
}
}
function _readINI_UseMiniTreeWhenMaxiTree_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree))
{
perm $p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree = getkey("UseMiniTreeWhenMaxiTree", "INI", self("file"));
}
}
function _readINI_UseHighlightingInTree_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree))
{
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree = getkey("UseHighlightingInTree", "INI", self("file"));
}
}
function _readINI_UseHighlightingInTreeWhenOtherICF_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF))
{
perm $p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF = getkey("UseHighlightingInTreeWhenOtherICF", "INI", self("file"));
}
}
function _readINI_UseAutoUpdate_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate))
{
perm $p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate = getkey("UseAutoUpdate", "INI", self("file"));
}
}
function _readINI_PermanentPathsInMiniTree_toPermIfNotSet() {
if (not isset($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree))
{
perm $p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree = getkey("PermanentPathsInMiniTree", "INI", self("file"));
}
}
/* ### INI Settings - Do not tamper with nor remove ###
[INI]
UseMiniTree=1
UseMiniTreeWhenMaxiTree=0
UseHighlightingInTree=1
UseHighlightingInTreeWhenOtherICF=0
UseAutoUpdate=1
PermanentPathsInMiniTree=""
[INI END]
*/
Code: Select all
Snip: CTB 1
XYplorer 22.40.0003, 28.10.2021 23:03:51
Action
NewUserButton
Name
Update MiniTreeWithOpenTabs
Icon
:minitree*#DEDEF0,r
ScriptL
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "main";
ScriptR
"_Initialize"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI UseMiniTree to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTree==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree=Use This Script to Update Mini Tree Structure: [is ON] - Turn off";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree_Icon=:select";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree=Use This Script to Update Mini Tree Structure: [is OFF] - Turn on (takes effect immediately)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree_Icon=:dark";
}
//-----------------------
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI UseMiniTreeWhenMaxiTree to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_UseMiniTreeWhenMaxiTree==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree=+Switch to Mini Tree if Normal Tree Is Present: [is ON] - Turn off";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree_Icon=:select";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree=+Switch to Mini Tree if Normal Tree Is Present: [is OFF] - Turn on (takes effect immediately)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree_Icon=:dark";
}
//-----------------------
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI PermanentPathsInMiniTree to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree=="") {
perm $p_autocart_MiniTreeWithOpenTabs_start_of_content_PermanentPathsInMiniTree = "empty";
} else {
perm $p_autocart_MiniTreeWithOpenTabs_start_of_content_PermanentPathsInMiniTree = strlen($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree) <= 40 ? substr($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree, 0, 40) : (substr($p_autocart_MiniTreeWithOpenTabs_PermanentPathsInMiniTree, 0, 37) . "...");
}
//-----------------------
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI UseHighlightingInTree to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTree==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree=Use This Script to ICF-Highlight Current Tabs in Tree: [is ON] - Turn off";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree_Icon=:select";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree=Use This Script to ICF-Highlight Current Tabs in Tree: [is OFF] - Turn on (takes effect immediately)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree_Icon=:dark";
}
//-----------------------
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI UseHighlightingInTreeWhenOtherICF to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_UseHighlightingInTreeWhenOtherICF==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF=+Overwrite Other ICF-Highlighting if Present: [is ON] - Turn off";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF_Icon=:select";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF=+Overwrite Other ICF-Highlighting if Present: [is OFF] - Turn on (takes effect immediately)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF_Icon=:dark";
}
//-----------------------
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Read INI UseAutoUpdate to Perm if not set";
if ($p_autocart_MiniTreeWithOpenTabs_UseAutoUpdate==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate=Automatic Updating: [is ON] - Turn off (manual updating stays always possible)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate_Icon=:sync";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate=Automatic Updating: [is OFF] - Turn on (for location change and pane switch)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate_Icon=:del";
}
//-----------------------
if (tweak("SkipBrowseEvents")==1) {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs=Location CEAs: [are OFF] - Turn on -- Attention: Might activate multiple CEA scripts!";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs_Icon=:nuke";
} else {
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs=Location CEAs: [are ON] (Caution: Turning off breaks this and maybe other CEA scripts!)";
goto "@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs_Icon=:-";
}
//-----------------------
"<@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree>|<@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTree_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle UseMiniTree";
" └ <@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree>|<@autocart_MiniTreeWithOpenTabs_label_ToggleUseMiniTreeWhenMaxiTree_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle UseMiniTreeWhenMaxiTree";
//-----------------------
"Edit Permanent Paths -- Content: ['$p_autocart_MiniTreeWithOpenTabs_start_of_content_PermanentPathsInMiniTree']|:udc"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Edit PermanentPathsInMiniTree";
//-----------------------
"-"
"<@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree>|<@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTree_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle UseHighlightingInTree";
" └ <@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF>|<@autocart_MiniTreeWithOpenTabs_label_ToggleUseHighlightingInTreeWhenOtherICF_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle UseHighlightingInTreeWhenOtherICF";
//-----------------------
"-"
"<@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate>|<@autocart_MiniTreeWithOpenTabs_label_ToggleUseAutoUpdate_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle UseAutoUpdate";
//-----------------------
"-"
"-"
"<@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs>|<@autocart_MiniTreeWithOpenTabs_label_ToggleLocationCEAs_Icon>"
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "Toggle location CEAs";
FireClick
0
SET UP
The script is primarily intended to work with the location change CEA "After browsing a folder" in order to update the tree on each location change and with the CEA "Switch panes" to update the tree on each pane change. Download the script file from the "DOWNLOADS" section (and remove the version number at the end) or copy and save the code and load that script file from inside of the location change CEA "After browsing a folder", for example, with
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "main";
as well as from within the CEA "Switch panes" to work also when switching panes. One might also want to load it from within the CEA "Drive added or removed" (compare "OPERATION and SETTINGS" > "Edit Permanent Paths" above). Of course, the script file name must be adapted if you save it under a different name.Toolbar ButtonHint:
Activating the setting "Tabs|Reuse existing tabs when changing the location" in the configuration dialog will make tabs be reused, even when changing locations through the tree. I feel that this is very practical.
Technically the script will work also without the toolbar button. The factory defaults for the settings are:
- Use This Script to Update Mini Tree Structure: [is ON]
- +Switch to Mini Tree if Normal Tree Is Present: [is OFF]
- Edit Permanent Paths: [empty]
- Use This Script to ICF-Highlight Current Tabs in Tree: [is ON]
- +Overwrite Other ICF-Highlighting if Present: [is OFF]
- Automatic Updating: [is ON]
- Location CEAs: This is an XY setting and can be changed also outside of the script.
Compatibility with SessionManager
To make the script compatible with the famous SessionManager script, all the lines
sub "_AutorunScript"
in the SessionManager code (there should be 2 occurrences) should be replaced with:sub "_AutorunScript";
load "MiniTreeWithOpenTabs_curLocExpanded_tabFoldersHighlighted.xys", "main";
. (Of course, here too, if a different script file name is used, the line must be adapted accordingly.)KNOWN LIMITATIONS
(1) If the instant color filter is set to a different value, then any current script's highlighting is overwritten and can only be restored by triggering or calling the script again, e.g. by clicking on the script's toolbar button.
(2) If a tab is closed or opened in the background, it does not trigger any event. Thus, the script cannot react to that. This can happen, e.g., if a different tab than the current one is closed. (If the current tab is closed, then that would normally trigger a change location event, which the script can react to.) It can also happen if tab sessions are switched with, e.g., the famous SessionManager script. In the latter chase it seems that sometimes some tabs are only opened after the current tab has been loaded and thus are not yet existing when script reacts to the location change event of the current tab.
In such cases, the script must be triggered or called again manually to update the tree, e.g. with the toolbar button. However, compatibility with SessionManager in particular can be restored. See "SET UP" above.
(3) If a folder is created or deleted in the current location, then this also does not constitute a location change and, thus, the script cannot react to that. Again, the script would have to be triggered or called manually to update the tree, e.g. with the toolbar button.
(4) So far, the script handles the tree for each pane separately. I am open to improvements.