TagCounter

Discuss and share scripts and script files...
serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

TagCounter

Post by serendipity »

Counts Labels, Comments and Tags

Code: Select all

//TagCounter
//Counts Labels, Comments or Tags in "My computer"
"Label"
  global $lookup, $lookup2;
  $lookup=Label;
  $lookup2=lbl;
  sub "_getcount";

"Comment"
  global $lookup, $lookup2;
  $lookup=Comment;
  $lookup2=cmt;
  sub "_getcount";

"Tags"
  global $lookup, $lookup2;
  $lookup=Tags;
  $lookup2=tags;
  sub "_getcount";

"_getcount"
  global $lookup, $lookup2;
  $tab= tab ("get");
  
  goto "%computer%?$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>;
  seltab $tab;
  text "Total=$total<crlf><crlf>$list";
  

Update: changed search to variable %computer%
Update 2: Added total count

Bug fix (31Mar2012): Fixed a bug with sorting folders apart
Last edited by serendipity on 31 Mar 2012 17:05, edited 2 times in total.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

Great job. :appl:

Can we list a little more information about the tags, labels & comments?

For example, a brief file/folder list of each label, tag, and comment.

Then, the script will have more powerful function, called Tag Summary :appl:

it can be a readable and informative version of tag.dat:-)

Thank you for sharing.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

There is a potential bug. One tag shows twice. Please see the attachment.
Attachments
2012-03-30_014110.png
2012-03-30_014110.png (8.44 KiB) Viewed 7157 times

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

Re: TagCounter

Post by serendipity »

paul0 wrote:There is a potential bug. One tag shows twice. Please see the attachment.
Strange, what do you get when you paste this in Addressbar:

Code: Select all

My Computer?tags:?*
Do you see 12 items or 8?

As to your suggestion for Tag summary, XY already does this with its search. Again, you'll see that when you paste the above code.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

serendipity wrote: Strange, what do you get when you paste this in Addressbar:

Code: Select all

My Computer?tags:?*
Do you see 12 items or 8?
I see 12. The total number is correct.

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

Re: TagCounter

Post by serendipity »

paul0 wrote:
serendipity wrote: Strange, what do you get when you paste this in Addressbar:

Code: Select all

My Computer?tags:?*
Do you see 12 items or 8?
I see 12. The total number is correct.
OK, I'll see whats going on.

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

Re: TagCounter

Post by serendipity »

I tested this but cannot reproduce, to that end I tagged some files with exact same tags you have and still cannot reproduce.
my script simply gets info from XY's search result:

Code: Select all

My Computer?tags:?*
I checked my script again and don't see what can go wrong.
Are you sure you can reproduce this? Maybe be restart XY and try again? No idea otherwise.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

XYplorer has been restarted. The bug can still reproduce here.

At the same time, I have cleaned up orphans using xyplorer tag setting (see attached picture)
Attachments
Clean up orphan tags
Clean up orphan tags
tag clean up.png (58.97 KiB) Viewed 7114 times

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

Here is a possible reason.

Here is a screenshot of step through dialog. Please make sure it takes two group of remove tags as the same tag.
Attachments
screenshot.png
screenshot.png (44.24 KiB) Viewed 7111 times

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

Find an error here:
Attachments
screenshot.png
screenshot.png (48.24 KiB) Viewed 7111 times

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

Re: TagCounter

Post by serendipity »

Interesting:
Can you try this:
1) My Computer?tags:?*
2) Sort list ascending in tags column.
3) are the "remove" tags separate or together?

I am asking this because my script simply takes XY's sort order and uses that list and formats it.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

serendipity wrote:Interesting:
Can you try this:
1) My Computer?tags:?*
2) Sort list ascending in tags column.
3) are the "remove" tags separate or together?

I am asking this because my script simply takes XY's sort order and uses that list and formats it.
It is wired. It cannot sort properly. Please see the attached screenshot.
Attachments
sorted.png
sorted.png (6.43 KiB) Viewed 7106 times

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

a new discovery.

The sorted results are group by folders and files.

The first 8 items are folders and the last four are files. Does this make sense now:-)
Attachments
group by folder and file.png
group by folder and file.png (9.57 KiB) Viewed 7105 times

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

Re: TagCounter

Post by serendipity »

paul0 wrote:a new discovery.

The sorted results are group by folders and files.

The first 8 items are folders and the last four are files. Does this make sense now:-)
Aah ofcourse! :oops: i forgot to disable sort folders apart and keep folders on top.

Try the script now.

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: TagCounter

Post by paul0 »

Yeah, working now :biggrin:

Post Reply