Complex Evaluator Column Code Request

If anyone is up for the challenge...
If I'm understanding Evaluator Columns correctly, this logic is probably possible, though I don't know if all of the needed properties of things exist on my laptop (I think they probably do).

And... My apologies for this terrible pseudo code. LOL

If (is folder)
	"Dirs: " & [number of subfolders (non recursive)] & ", Files: " & [number of files]
If (is image)
	[width in pixels] & " x " & [height in pixels]
If (is .PDF or is .Doc*)
	"Pages: " & [number of pages]
If (is audio)
	[length in minutes]
If (is .DLL or is .ICL)
	[number of .ICO files in library]
Else (none of the previous match)
	[Size in MB]

Does this even makes sense to folks?

The Swiss Army Knife of eval columns :wink:

I don't think all info is available, but here's a start:

if(is_dir) return "...";

if(Match(fullpath, "grp:Images", "f")) return picwidth + "x" + picheight;

if(ext=="pdf" || ext=="doc") return "Pages: " + pages;

if(Match(fullpath, "grp:Music", "f")) return mp3songlength;

if(ext=="dll" || ext=="icl") return "...";

size
XML
<?xml version="1.0"?>
<evalcolumn align="0" attrrefresh="no" autorefresh="no" foldertype="all" keyword="t48959" maxstars="5" namerefresh="no" reversesort="no" title="t48959" type="0">if(is_dir) return &quot;...&quot;;

if(Match(fullpath, &quot;grp:Images&quot;, &quot;f&quot;)) return picwidth + &quot;x&quot; + picheight;

if(ext==&quot;pdf&quot; || ext==&quot;doc&quot;) return &quot;Pages: &quot; + pages;

if(Match(fullpath, &quot;grp:Music&quot;, &quot;f&quot;)) return mp3songlength;

if(ext==&quot;dll&quot; || ext==&quot;icl&quot;) return &quot;...&quot;;

size</evalcolumn>
2 Likes

Thanks Ixp, that does help!

Incidentally... It's too bad that a person can't view the 'metadata' of the various default properties/info, to get the corresponding Evaluator definition. For example, there is a 'Files' column that can be added, which will return the number of files in a folder. There is no clue what the corresponding Evaluator definition would be though.

Here's your updated first line:

if (is_dir) return "Dirs: " + dircount + ", Files: " + filecount;

Counting the .ico files is on you :slight_smile:

1 Like

LOL. You've gotten most of it figured out for me -- So many thanks!

Question though: how do you know what words to use? For example "dircount" and "filecount". Are those in the documentation somewhere?

Yes.

Keywords for Columns - dircount

You can also add the columns that interest you to the file display and get their names with

ClipCopy COLUMNS

ClipCopy

1 Like

Very cool! Also I just found the grammar and stuff in the Evaluator section of the help docs. I had not seen that part before. I will study this info and I have marked this thread as "Solved." Thanks again, Sir!

Sorry about resurrecting this thread, after previously marking it answered... But how does a person set up the Evaluator Columns to automatically update? The 'size' and 'pixel' components seem to automatically show the correct information, but the "Dir: Files:" one does not.

lxp's code, from above, looks like:

if (is_dir) return "Dirs: " + dircount + ", Files: " + filecount;

If I make a change in the 'Folder Formats' dialog, then click save, the number of Dirs and Files does get updated and returned, but if I just browse to a folder, then it appears as in the below screenshot. F5 (refresh) does not help.

I guess you stumbled upon this issue:

Eval columns that access script columns don't refresh properly

(Similar here)

That's a drag. But yeah, it appears so. Thanks lxp!