Page 1 of 1

Custom Columns File Name Character Count

Posted: 25 Jul 2014 16:30
by dennydraco
Hope this hasn't been posted previously, if so can someone direct me to it.

Can a custom column be made to give you the file name character count (with or without the file extension)?

Re: Custom Columns File Name Character Count

Posted: 25 Jul 2014 16:36
by Marco
You mean that, given

Code: Select all

C:\folder\file.txt
the output should be 4?

Re: Custom Columns File Name Character Count

Posted: 25 Jul 2014 16:41
by dennydraco
yes, exactly

Re: Custom Columns File Name Character Count

Posted: 25 Jul 2014 16:43
by bdeshi
enter ::snippet; in addressbar and paste this code to create the column definition as NameLen.

Code: Select all

Snip: CustomColumn 1
  XYplorer 14.30.0301, 7/25/2014 8:42:13 PM
Action
  ConfigureColumn
Caption
  NameLen
Type
  3
Definition
   $n = strlen(<cc_name>);
   if <cc_ext> != '' {$r = "/".($n - strlen(<cc_ext>) -1);}
   else {$r = "/".$n;}
  return $n$r;
Format
  0
Trigger
  1
Item Type
  2
Item Filter
  
[/size]It's return value is like this: <length of name with ext>/<length of name without ext>

If you don't want it to apply to folders, then select "Files" as the coulmns itemtype. Also in this case, the script may be highly simplified.

Re: Custom Columns File Name Character Count

Posted: 25 Jul 2014 17:16
by dennydraco
Thanks for the script. That's what I needed. :beer:

Re: Custom Columns File Name Character Count

Posted: 25 Jul 2014 17:17
by bdeshi
:beer: