Personal Disk Grouping?

Hello, can you please tell me if it's possible to grouping disks to my group using Dopus's basic tools?

and if not, is it possible to implement it?

Let's say I'd like HDD drives F, U, Z to be in my own "backups" or "work" category.
And at the same time, drives A, C, E were in the "system" category... and so on.

Yes, you can define an Evaluator Group via Preferences / File Display Columns / Evaluator Groups that takes care of this. It could look like this and would group the Name column in the "This PC" page:

XML
<?xml version="1.0"?>
<evalgroupscheme reverse="no" scheme_name="GroupDisks" sort="no">
	<eval>if (Len(value) != 2) return;
if (Right(value, 1) != &quot;:&quot;) return;

d = Left(value, 1);

if (InStr(&quot;CDE&quot;, d) &gt;= 0) return &quot;work&quot;;
if (InStr(&quot;FGH&quot;, d) &gt;= 0) return &quot;backups&quot;;
if (InStr(&quot;IJK&quot;, d) &gt;= 0) return &quot;system&quot;;

return;</eval>
	<groups enable="no" />
	<columns>
		<col default="no" id="0" />
	</columns>
</evalgroupscheme>

How to use buttons and scripts from this forum

mmmm.... Not work?

You need to display that newly created column so you can sort by it.
As a side note: No need to use : since only the first character is searched.

As I understand it, I need to do this using "Evaluator column" ??

Did you actually group the column by the new scheme?


BTW: we didn't create a column :slight_smile:

Oh, you mean that...
Yeah, that's enabled...
I did that right at the start.
Also, while I was figuring out why it wasn't working and trying out different options, I updated the lister every time.

I haven't fully figured everything out yet, but I asked GPT to explain the code to me, and it made a fix that worked for me.

I still don't understand exactly what's going on here—since this isn't really my thing—but I'll just leave this here:

if (InStr(value, "A:") > 0) d = "A";
elseif (InStr(value, "C:") > 0) d = "C";
elseif (InStr(value, "D:") > 0) d = "D";
elseif (InStr(value, "F:") > 0) d = "F";
elseif (InStr(value, "G:") > 0) d = "G";
elseif (InStr(value, "H:") > 0) d = "H";
elseif (InStr(value, "T:") > 0) d = "T";
elseif (InStr(value, "W:") > 0) d = "W";
else return "other";

if (InStr("CAG", d) >= 0) return "work";
if (InStr("FD", d) >= 0) return "backups";
if (InStr("TH", d) >= 0) return "system";

return "other";

Anyway, thanks everyone; before this, I was convinced that something like this was completely impossible.

UPD:
This might come in handy for someone.

I’m not a programmer at all, but it was actually interesting to get into it. After a couple of hours, I managed to figure out how to deconstruct the code—albeit somewhat clumsily.

After adapting it to my needs, I ended up with code that is more "elegant" and versatile...

work    = "GTH";
backups = "OPTREWNMUSXYZ";
system  = "AC";

if (Len(value) < 2) return "Other";

if (Right(value, 1) != ")") return "Other";
if (Mid(value, Len(value) - 2, 1) != ":") return "Other";
if (Mid(value, Len(value) - 4, 1) != "(") return "Other";

d = Mid(value, Len(value) - 3, 1);
// ============================
// GROUPS
if (work ~~ d) return "work";
if (backups ~~ d) return "backups";
if (system ~~ d) return "Sys";

return "FFFFFFF";

I’m not sure if it will work with other DOpus disk formats. Also, don’t trust GPT—it mixes up numerical positions.

Here's an evaluator clause that one can customize to fit its need.

It takes into account the fact that the appearance (display name) of the drives may differ depending on the settings "Preference/Folders/Virtual Folders/This PC".
This setting can take 5 formats:

  • Local Drive (C:)
  • C:
  • C: (Local Drive)
  • C: Local Drive
  • Local Drive

Obviously the last one can not be used with this script. For each of the other ones, there's a regexp defined in the script. You just have to choose the one that fits your settings and uncomment it, the other ones should be commented. The current settings in the script below matches the first one of the list above.

Then, you will also have to define your groups, and the letters that you want to associate with these groups.
That has to be done in the section that looks like this:

// --- Change the associations below to suit your needs

ArrayPush(groupNames, "1 - System");
ArrayPush(groupLetters, "C");

ArrayPush(groupNames, "2 - Data");
ArrayPush(groupLetters, "BFGIJZ");

For each group you want, you'll need two lines:

  • The first one defines the name of the group (just change the "2 - Data" part in the below example). You can use a number to start if you want to be able to manage the order the groups display (and use the "Sort groups alphabetically ..." option under the evaluator clause in the configuration dialog).
ArrayPush(groupNames, "2 - Data");
  • The second one lets you define all the drive letters that will fall into that group:
ArrayPush(groupLetters, "BFGIJZ");

If there are too many groups in the full clause below, comment or remove the unneeded ones (both two lines each time). If you need more, add those two lines as many times as you need and set-up the proper group names (1st line) and the associated drive letters (2nd line).

Full evaluator clause:

// The different regexps matches the different settings for how the drive names appear in 'This PC'
// Uncomment only the one that matches your setup

// ----
// Format: Local Drive (C:)
letter = RegEx(value, ".*\(([A-Z]):\)", "\1", "e");

// Format: C:
//letter = RegEx(value, "([A-Z]):", "\1", "e");

// Format: C: (Local Drive)
//letter = RegEx(value, "([A-Z]): \(.*\)", "\1", "e");

// Format: C: Local Drive
//letter = RegEx(value, "([A-Z]): .*", "\1", "e");

// Format: Local Drive
// Sorry ... no letter, no grouping

// ----



if (letter == "") return "Unknown (no letter)";
//Output("letter ok");

//map = [ "1-System" = "C"; "2-Music" = "ADEKPQ" ];
//Output(DumpVars());
groupNames = ArrayCreate();
groupLetters = ArrayCreate();

// --- Change the associations below to suit your needs

ArrayPush(groupNames, "1 - System");
ArrayPush(groupLetters, "C");

ArrayPush(groupNames, "2 - Data");
ArrayPush(groupLetters, "BFGIJZ");

ArrayPush(groupNames, "3 - Music");
ArrayPush(groupLetters, "ADEKPQ");

ArrayPush(groupNames, "4 - Backups");
ArrayPush(groupLetters, "NOS");

ArrayPush(groupNames, "5 - Shared");
ArrayPush(groupLetters, "VWXY");

ArrayPush(groupNames, "6 - Optical");
ArrayPush(groupLetters, "ML");

ArrayPush(groupNames, "7 - Removable");
ArrayPush(groupLetters, "HNRTU");

// --- 

//Output(DumpVars());

if (Len(groupNames) != Len(groupLetters)) {
	Output("Arrays for Group names & letters do not have the same size. Checkk the script");
	return "Unknown (Script error)";
}

found = false;
group = "";
for (a = 0; a < Len(groupNames); a++) {
  gpName = ArrayGet(groupNames, a);
  gpLetters = ArrayGet(groupLetters, a);
  //Output("Drive=" + letter + " / gpLetters=" + gpLetters + " / gpName=" + gpName);
  if (gpLetters ~~ letter) {
  	found = true;
	group = gpName;
	break;
  }
  //Output("Not matching ...");
}

if (found) return group;

return "Uncharted";