Collection feature

Hello again,
I'm still trying to add the drive/volume name to the file location information in a lister, which I intended in my request a few weeks ago.
I have already explained before that, despite the years I have been using DO, I am far from knowing even 10% of the power available in DO in terms of file management. So, for the past few weeks, I've been reading the manual, looking for some way to reach my goal, and have found the chapter "Adding a new Column from Shell Properties" in the part that explains "scripting / example scripts", and I've thought that it could be a valid formula to include in the lister, the name of the volume that contains the file in question, which is definitely what I'm looking for.
Here I am assuming that one of the shell properties is precisely the name of the disk / volume.
Unfortunately, I'm a complete useless as far as programming is concerned, and issues like javascript or vbscript are completely unfamiliar to me. As if that were not enough, when trying to add a script using the code that appears as an example -to use it as a model- in the indicated chapter, it does not allow it as javascript and I do not know what to do.
So, I go back to the community for information about what is happening to me, and how to fix it.

Many thanks again,

Here's a script for a custom column that will show the VolumeName. It can be used in a Rename command to save the name of volumes that will later get detached.

function OnInit(initData) {
    initData.name = 'VolumeName';
    initData.default_enable = true;
    initData.min_version = '12.0';
    var col = initData.AddColumn();
    col.name = 'VolumeName';
    col.method = 'OnVolumeName';
    col.label = 'VolumeName';
    col.justify = 'left';
    col.autogroup = true;
}

function OnVolumeName(scriptColData) {
    var item = scriptColData.item;

    var srcPath = item.path;
    if (srcPath.drive == 0) return;

    var fso = new ActiveXObject('Scripting.FileSystemObject');
    srcPath.Root();
    var srcDrive = fso.GetDrive(srcPath);
    scriptColData.value = srcDrive.VolumeName;
}

ColumnVolumeName.js.txt (655 Bytes)


Thank you very, very much!!!

A question:
I have read somewhere that the VolumeName property (I think it was that way) remains stable even though for some reason the volume changes its assigned letter. Would this script work as well?

Yes, DriveLetter and VolumeName are two separate and independent properties.

Excuse my stupidity: I don't understand how I can do this.

The custom column can be used like any other column or metadata in the Rename command. You'll find it in the Script section:

Thank you very much, I will study it.