Tab-Labelizer - Extend the folder names shown in your tabs

Overview:
This is an event driven script-addin, able to extend the labels of your Directory Opus folder-tabs.

Features:

  • add parent folder to tab-label
  • add "sticky" location to tab label (drive letters or hostnames e.g.)
  • replace volume- or foldernames with custom values/aliases (turn C: into SYS: e.g.)
  • use of ".." where sensible, to get rid of loooong foldernames
  • external options-object to easily enhance interplay with dopus buttons/lister variables
  • some minor bits

Screenshots:
without/before:



with/after:

.

Installation:
Download and drag the latest version over to the scripts section in the DO prefs-window.
Make sure you have it enabled. Pay attention while adding/removing strings in the config. The config part is in JSON, so commas are important to be added/removed accordingly e.g.

Please note:
When adding/editing paths, make sure you use 4(!) backslashes for every backslash you need. This is because jscript and the regular expression engine likes backslashes to be escaped, kind of ill, but that's how it works. Look the given paths and example-replacements in the script-config to get a better understanding of this.
.

Download:
Latest:

  • v1.5.1 / 2017.09.06 - update viewer title, performance+, show friendly ftp site name, show drive label
    Tab-Labelizer.js.txt (37.4 KB)

  • v1.3.2 / 2015.04.20 - version up and configurable label for empty tabs:
    Tab-Labelizer.js.txt (32 KB)

  • v1.3.1 / 2015.04.19 - fix to prevent error messages for empty tabs:
    Event.GUI_TabLabelizer.js (31.8 KB)

  • v1.3 / 2015.04.11 by Wowbagger - version string fix, scriptwizard support:
    Event.GUI_TabLabelizer.js (31.6 KB)

2 Likes

Interesting script. thanks for sharing

Hi tbone, I like your script, very helpful.

I modified it to add some extra features.

  • Support for FTP addresses. Currently they we displaying the full path including the credentials.
  • All paths use DisplayName, this is only needed for lib paths I believe, but does not cause issues for other paths.
  • Support for lib paths.
  • Support for resolving paths. An alternative to using the lib paths, if you would rather actual paths.

I have improved the handling of library paths, my earlier attempt did not work very well. Using the FSUtil.DisplayName method helps. See post above for script.

Version 1.1 posted! - Initial post updated.

Thanks wowbagger! Your enhancements are very welcome, you are keeping half of the copyright now! o)

Notice: I removed the inline code, as it converts the tab-character to spaces (3 of them), which is terrible to handle I think. I used a js-beautifier to get it indented and styled nicely again.

Nice work on the new version and cleaning up the code. :slight_smile:

jjantell asked in this post about being about the set the title of the lister to something that is not in the list of configurable options. This script is not exactly what jjantell wanted but should be a good start. Also setting the title seemed like a nice addition to this script. The option to set the window title is handy when hovering the taskbar icon in windows as normally the long path would be cut off.

I have updated the script to version 1.1e

  • Added option to set Window Title to the shortened path
  • Moved Top level config (Debug, EnableTabUpdate, EnableWindowTitleUpdate, ResolvePaths) to script config
  • Packaged in osp file. Because we can't upload js files, this saves renaming to txt
  • Leveraged new feature in 11.4.4 Set LISTERTITLE "notoggle:title" and removed hack second calls to OnActivateTab.

Updated to 1.1e now requires dopus 11.4.4 See post above for script and change details.

Hi wow! o) The labelizer is in need for some updates. There have been changes in the scripting of DO, which lead to errors recently.
I even think the dopus team made property-name changes without telling us. o) I want to inform you herewith, to prevent work to be done twice.

Did you made additional changes I should know of and incorporate? In the meantime I added a layout blacklist, all config items to be changed from the GUI, options to set empty label and empty lister title names and complete new log output (again o).

Anybody elses ideas and enhancements are welcome of course as well! o) cya, tbone

What properties are you talking about?

I think it was "ActivateTabData", which now uses ".newtab" and ".oldtab" instead of ".new"/".old". The latter variant has always been a bit problematic as "new" is a js-keyword and needed a workaround (using ActivateTabData["new"] notation). This change is welcome, I do not recall a hint on that though. Now that I write this, I feel like this has been talked about some weeks/month ago, but as the script worked up to some latest beta, these props must be quite new I think.

The change was in the release notes, and the old properties are actually still there (just undocumented), so it wouldn't have broken any existing scripts.

Ok, then I must have misinterpreted a script error and did not read that beta-description of 11.4.1 thoroughly enough in may! o)
Sorry for being wrong, it wasn't meant offensive anyway, you know that! o)

Hi tbone. My latest changes were in version 1.1e. Look FW to the new version :slight_smile:

The error was caused by change in Directory Opus 11.5.5 (beta).

This meant that you could not call string methods (like resolve in our case) on the path object returned from the Resolve method. You can see object type using this code

Object.prototype.toString.call(path)

Updated the script to V1.2, it now requires DOpus 11.7

  • Updated to be compatible with DOpus 11.5.5 and later versions (fixed bug caused by change to Resolve method).
  • Added config descriptions (new feature in DOpus 11.7).
  • Added ExtendedConfig, which is multiline config (new feature in DOpus 11.7). the internal JSON config can now be edited in the config window.

Re the ExtendedConfig. I took the JSON object that is in the code and stringify'ed it. This can then be edited by the user saving them from needing to edit the script. Stringify'ing the JSON object is nice as we don't need manually convert it to a string in code which would require lots of escaping. One downside is the extended config comments that are in the code don't show in the config window. Not sure if I have created any performance issues here.

Feedback most welcome.

Tbone, I guess we are the only ones that use this script as no one else seemed to notice that it was not working any more.

Hi wow!
I don't think we are the only ones, I mean there have been 73 + 20 downloads so far. But I agree, quite strange that nobody came back to tell it doesn't work anymore. o) Maybe most of the poeple do not upgrade as often as we do, so the former version may still be in charge and some may fix things on their own, who knows. o)

Thanks for providing this version. I'd like to call that an intermediate-fix-version, as the work in progress on my side takes account of everything you added and more. I unfortunately lag behind finishing it, so it's good to have that. I move that version to the thread opening and would like you to remove it right above, alright?

EDIT: Done, descriptions and instructions changed a bit to reflect your changes.

Hi tbone, the one posted as 1.2 has the wrong version number.
I have updated it and added support for the script wizard.

Thanks wow! o)
I pulled that as v1.3 into the thread opening to avoid confusions.
Because there is SW support from now on, a small version increment surely doesn't hurt.

Do you mind removing all of your recent snippets and uploads to keep this thread a bit shaped?

Updated to v1.3.1:

  • fix to prevent error messages for empty tabs

@wow, thanks for the cleaning job! o)

Good pick up tbone.
Can we make that configurable? I would rather it say 'Empty Tab' than '-'.
You forgot to update the version in the script to 1.3.1. Perhaps this is something the SW could detect?

The script has progressed a lot since you first wrote this little gem. The first post is a little out of date, it does not talk about the setting the title. Might be worth doing a review.

I noted recently that dopus has built in ability to shorten a path. I does it in some dialogs. Do you know if that functionality is exposed?

Updated to v1.3.2:

  • version increase and configurable label for empty tabs

Yes, I agree. o) The thing is, I have another branched and enhanced version in "progress", I already mentioned it here: Tab-Labelizer - Extend the folder names shown in your tabs Now that was in August last year, oops. o) I'm going to overhaul the intro once that version is done.