testing the following JavaScript snippet in the Command Line Interpreter Tool:
var lister = DOpus.listers.lastActive
DOpus.Output( lister.activetab.label )Don't get a value for .label. I get numbers (addresses) for lister and lister.activetab. So I assume the objects are valid.
yep, that was the problem. The following snippet works:
var lister = DOpus.listers.LastActive
DOpus.Output( lister.activetab.path )BUT pls. mention that in the help file. And I'm not happy with that property at all because I get then the full path (e. g. DRIVE:\PATH0\PATH1). So I must first check whether .label is empty and then split the path. A new property e. g. text would be advantageous.
Add .filepart to the path to get just the last name.
Scripts will almost always need to tell the difference between a custom label and the default label, so you'll probably run into the same thing one way or another. (Depending on what you're aiming to do with the label, which I don't know.)
For example, if you want to change the label but then change it back later, you need to know if it was custom or not. Setting it back to what the proposed "text" would give you would then fix it to that name even when you changed folders.
OTOH, if you want to add to the label, then using the current path isn't usually the best way to do it. There are % codes you can use to insert the current name or path instead.