TagCounter

Discuss and share scripts and script files...
eil
Posts: 1827
Joined: 13 Jan 2011 19:44

Re: TagCounter

Post by eil »

serendipity, will it be too difficult to modify your script for it to search not in whole PC, but only among selected items(+if there are folders-> in subs)? :roll: yet, it could be useful to have a 4th item in popup- "count all". but i'm afraid such will require an additional editing for resulting report... :cry:
Win 7 SP1 x64 100% 1366x768|1900x1080

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: TagCounter

Post by serendipity »

eil wrote:serendipity, will it be too difficult to modify your script for it to search not in whole PC, but only among selected items(+if there are folders-> in subs)? :roll: yet, it could be useful to have a 4th item in popup- "count all". but i'm afraid such will require an additional editing for resulting report... :cry:
Sure. v2 does both. It detects if folders are selected and searches only those. If nothing is selected it searches whole computer. I now have the fourth item for counting all 3 tags.

Code: Select all

//TagCounter v2
//Counts Labels, Comments, Tags or all three in "My computer" or selected items


"_getselected"  
  global $path;
  focus;
  IF (<get CountSelected> < 1){
  $path=%computer%;
  }

  ELSE {  
       FOREACH($folder, <get SelectedItemsPathNames |>){
              IF(exists($folder)==1){
              end 1==1, "Select ONLY folders.<crlf>To search whole computer remove all selections"; 
              }
              ELSE{
              $path=get("SelectedItemsPathNames", ";");
              }
            }
  }

"Labels|:labels"
  global $lookup, $lookup2;
  $lookup=Label;
  $lookup2=lbl;
  sub "_getcount";

"Comments|:udc"
  global $lookup, $lookup2;
  $lookup=Comment;
  $lookup2=cmt;
  sub "_getcount";

"Tags|:tagsfind"
  global $lookup, $lookup2;
  $lookup=Tags;
  $lookup2=tags;
  sub "_getcount";
"-"

"All above"
  global $lookup, $lookup2, $tab, $path;
  sub "_getselected";
  $tab= tab ("get");

  copytext;
  $lookup=Label;
  $lookup2=lbl;
  sub "_getallcount";

  $lookup=Comment;
  $lookup2=cmt;
  sub "_getallcount";

  $lookup=Tags;
  $lookup2=tags;
  sub "_getallcount";
  $path=replace ($path,";","<crlf>");
  text "Paths<crlf>$path<crlf><crlf><clipboard>",,,,w;
  seltab $tab;



"_getcount"
  global $lookup, $lookup2, $path;
  $tab= tab ("get");
  
  sub "_getselected";
  
  goto "$path?$lookup2:?*"; 
  setting "SortFoldersApart",0;
  setting "KeepFoldersOnTop",0;
  sortby $lookup, a;

  $tags = report ("{$lookup}|"); 
  $tags = formatlist($tags,"ed","|");
  $lblcount= gettoken($tags, "count","|");
  $count=1;
  $report="";
  WHILE($count<=$lblcount){
    $filter=gettoken($tags, $count,"|");
    selfilter $filter,,"$lookup";
    $filtercount=<get countselected>;
    $report= "$report<crlf>$filter=$filtercount";
    $count++;
    }
  filter;
  $list= formatlist($report,"e","<crlf>");
  $total=<get countitems>;
  
  $path=replace ($path,";","<crlf>");
  text "Paths<crlf>$path<crlf><crlf>Total $lookup=$total<crlf><crlf>$list",,,,w;
  seltab $tab;
  

"_getallcount"
  global $lookup, $lookup2, $tab,$path;

  goto "$path?$lookup2:?*"; 
  setting "SortFoldersApart",0;
  setting "KeepFoldersOnTop",0;
  sortby $lookup, a;
  $tags = report ("{$lookup}|"); 
  $tags = formatlist($tags,"ed","|");
  $lblcount= gettoken($tags, "count","|");
  $count=1;
  $report="";
  WHILE($count<=$lblcount){
    $filter=gettoken($tags, $count,"|");
    selfilter $filter,,"$lookup";
    $filtercount=<get countselected>;
    $report= "$report<crlf>$filter=$filtercount";
    $count++;
    }
  filter;
  $list= formatlist($report,"e","<crlf>");
  $total=<get countitems>;

  copytext "Total $lookup=$total<crlf>$list<crlf><crlf>",a;

eil
Posts: 1827
Joined: 13 Jan 2011 19:44

Re: TagCounter

Post by eil »

magnificent! :appl: thanks.
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply