Is there a way to have separate file and folder indexes?
So that when you expand a folder the files have their own index numbers, but in the same Index column?
Quite possibly.
I need to think on this, but it may be possible to define an Evaluator Column
to accomplish this.
Some time ago a question came up about random numbers as a column using Evaluator code.
In the time since, Directory Opus now has an Evaluator random number function, but it returns the same number for all file/folder listings. My simple homemade answer returns different random numbers for each file/folder listing even when using expanded folders.
So I think it can be done, but I need to think more about it.
I found an hour to tinker around some with this.
Very Happily, It can be done, but there needs to be knowledge as to when the last folder/file is reached so that the variables can be unset. My simple attempt uses only global variables so exiting Dopus and restarting clears the index.
It is possible to have the file index start again with each folder encountered in expanded view, but file groupings kind of make this pointless. To me at least it makes more sense to simply index all folders and all files separately. The result respects groupings then.
As I said, this is only an hour extra time into this.
Here's what I have with stupidly named variables still there.
If (is_dir)
{
if ( $glob:dirindex)
{
x=$glob:dirindex;
x=x + 1;
$glob:dirindex=x;
}
else
{
$glob:dirindex=1;
x=1;
}
}
else
{
if ( $glob:fileindex)
{
x=$glob:fileindex;
x=x + 1;
$glob:fileindex=x;
}
else
{
$glob:fileindex=1;
x=1;
}
}
return x
It does number nicely within file groupings.
The problem is where is the end so that the variables can be unset.
Interesting.
But I realized that if I want to know how many files or folders I have in the current lister, I can see the total numbers:
And if I want the files index to start from 1 I can click on the folders icon to hide folders, and so the files index will start from 1. So that is a good enough work around for the rare times my request would be useful. Thanks for the help though.
Yeah, but then we don't see the larger view.
I tried my simple code with other scoped variables.
The only variable scope that works is global.
Even lst: for lister doesn't work and results in a script variable scope error.
It could be very useful to have an additional variable scope feature within evaluator that identifies 'instance' or some kind of 'instance ID' so that the variable is unset at each refresh.
After a little thought, I think it may be better to make two new evaluator index columns, one for files and one for Dirs, but maybe not.
I thought of using Evaluator Rnd() to create a session ID to a global variable and then output a new value of Rnd() to the global variable. It works internally , but can't be exported to the global variable. The variable when defined takes on the original value and output changes to the original value.
I know it is bad Mathematics to even attempt this, and probably bad programming too.
I even tried an Atan() and then a Cos() to change the value exported, but it is either a bug or this idea is locked out for a reason.
I'll start a new thread tomorrow with a better discussion of this.
Rnd() produces the same number for all files and folders.
A refresh changes the number.
Scripting is probably the better answer, but I wanted to try it given how well it almost worked.
Ok. I'll put a request about the icons on the filter bar.
You could reset the counters at the beginning, e.g.:
if (index==1)
{
$glob:dirindex=0;
$glob:fileindex=0;
}
The problem with their global scope remains but that could be an acceptable flaw feature.
@lxp
Sometimes we are looking too closely at the problem.
This is a classic case of not seeing the forest for the trees.
Thankyou ! That solves my part in this thread.
I'm changing it into two Evaluator Columns though, one for files and one for dirs.
Edit:
In case anyone wants to try these.
Index Dirs
if (index==1)
{
$glob:dirindex=0;
$glob:fileindex=0;
}
If (is_dir)
{
if ( $glob:dirindex)
{
x=$glob:dirindex;
x=x + 1;
$glob:dirindex=x;
}
else
{
$glob:dirindex=1;
x=1;
}
}
else
{
return;
}
return x
Index Files
if (index==1)
{
$glob:fileindex=0;
}
If (is_dir)
{
return;
}
else
{
if ( $glob:fileindex)
{
x=$glob:fileindex;
x=x + 1;
$glob:fileindex=x;
}
else
{
$glob:fileindex=1;
x=1;
}
}
return x