Another small addition I'm finding useful:
When creating a naming convention with a view of parsing long file names into regex columns, one risk is to run out of characters for the file name (the Windows max for path + file name is 260).
The following tweak adds columns so you can keep track of the length of file names.
In the column definitions:
{ name:"c.namelen",
// this column give you the length of the file name
},
{ name:"c.charsleft",
// this column give you the number of chars still available to use in the path + file name
// Windows imposes a 260 maximum length for the Path+Filename
},
// no need for a custom column for the length of file + pathname as that column is available under General / Path length
In OnCustomText:
// filename length column?
if (config.name == 'c.namelen') {
scriptColData.value = scriptColData.item.name.length.toString()
}
// characters left column?
else if (config.name == 'c.charsleft') {
// Windows imposes a 260 maximum length for the Path+Filename
// how many more chars available in the path + filename?
var PathLength = new String(scriptColData.item.realpath).length
scriptColData.value = (260-PathLength).toString()
}
else { // it's a regex column
if(!config.itemProperty)
// etc
Thanks for all the feedback @playful and @Miran. Both your scripts were good reading.
A new version V1.5 has been created that uses a dialog to configure the columns. See First post.
Updated to version 1.5.2. This added support for passing in extend item properties, (I.E. metadata.doc.author) as the source input for the regexp to execute against.
Well technically not the RegExp. The RegExp that special string we created to extract parts of the file name. The issue was in this custom column script. I didnt get the grouping right, and was disabling grouping on all the columns it created. Dopus was doing exactly as asked.
Thanks for confirming it's fixed.
Now for a real question. I have created a regexp to isolate an identifier in the filename with the format XX followed by 3 digits followed by zero or more suffix letters. This identifier can appear anywhere in the name and is not necessarily present.
I am using: (.\*)(\bXX\d{3}[\w]*)(.\*) and my output criterion is $2. It works fine when there is a match for $2 but when there is no match the result is the whole original string. e.g.
Some text XX123a some description.txt ==> XX123a
XXxxx some description.txt ==> XXxxx some description
I would like a mismatch to return an empty string. I am no expert so my regexp may well be incorrect for what I want and of course this behaviour may be working as designed. Advice welcomed....
I don't know if I would call that a bug of a feature ;).
I updated the script to first check if the regexp is a match before preforming the replace. Otherwise the replace method would return the the input as there was nothing to replace. This seems better.
I don't know if you can force the column to reload. The script only reloads the column values when you press apply.
Added a checkbox in column settings, when enabled in case of "graph" or "igraph" types, the script make the graph relative to the largest value of all items inside current folder. The performance of the script is great, as I check for the max value only once and store it in script variable as long as the folder path is not changed.
Added three sample columns to demonstrate the "Graph Related" feature.
Added a button in the dialog to restore the sample columns
Thanks for your input @asakka.
With DOpus 12.7.3 we now have relative columns, without the need to pre-scan the folders. I have also looked at the multiple column calculations issue your raised. Let me know what you think.
Updated to version 1.8
Added support for new columns in 12.7.3graphrel, igraphrel and percentrel.
Added support for text column formatting. Allows for extracted value to be case formatted before displaying in the column.
Supported formatting - upper, lower and title
I recall someone asking to be able to format the name column, but I can't find that post now. Still I thought this would be a handy addition to the script.
Added support for targeting the file contents. This can be somewhat expensive and would benefit from combining with a file filter. I do try to only read each file once regardless of how many columns are selected.
I actually added this a while back but remove it due to some performance issues, but those were resolved around version 1.8. I forgot to add it back in.