Find all tags

Discuss and share scripts and script files...
binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Find all tags

Post by binocular222 »

I made "search by tags" a bit easier (less typing/less clicking) by this script:

Code: Select all

 $input = input(Search by Label | Tags | Comment   (Separate by  | )<crlf>Example:    Email  | sale report |Maria     (leave blank to view all tags database),"Case insensitive, removed leading & trailing spaces and |<crlf>Tags in use: " . getkey("TagsList", "Settings"),|,s,,300,10);
 $Label = "lbl:" . gettoken($input,1, "|") . "*";
 $Tags = " AND tags:" . gettoken($input,2, "|") . "*";
 $Comment = " AND cmt:" . gettoken($input,3, "|") . "*";
	$Search = "*?:" . $Label . $Tags . $Comment;
	goto "$Search"
An input dialog appear and you can type search term for Label|Tags|Comment while don't have to type *?:lbl: AND tags: AND cmt:
Besides, leave the input dialog blank to view all tag database.
Update: Totally rewirte: Use gettoken to simpplify
Last edited by binocular222 on 09 Jan 2013 04:52, edited 2 times in total.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Find all tags

Post by admin »

Here is a tag finder that makes use of some useful scripting functions:

Code: Select all

// search whole computer for items that have any out of a couple of tags
  // trim the items in the tag list
  $taglist = formatlist(taglist(), "t", ",");
  $tags = inputselect("Find by Tags<crlf>Tick the tags that shall be matched.", $taglist , ",", 2);
  // make it an OR-ed list
  $tags = replace($tags, ",", "|");
  goto "*?tags:""$tags"" /rv"

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: Find all tags

Post by binocular222 »

My script searchs for Label, Comment also, not just Tags
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Find all tags

Post by admin »

Yes, I just wanted to show the use of some functions.

Kees54
Posts: 5
Joined: 04 Jan 2013 15:31

Re: Find all tags

Post by Kees54 »

This is what I want!
Thanks a lot, it works both!

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: Find all tags

Post by binocular222 »

Another script: Find items with similar Label/Tag/Comment (support multiple selected items)

Code: Select all

  $Label = trim(formatlist(report("{Label} or ",1), "de"), " or");
  $Tag = trim(formatlist(report("{Tags} or ",1), "de"), " or");
  $Comment = trim(formatlist(report("{Comment} or ",1), "de"), " or");
  If(report("{Label}", 1) != "") {$CountLabel = 1;  $Label = " AND lbl:" . $Label};
  If(report("{tags}", 1) != "") {$CountTag = 1;  $Tag = " AND tags:" . $Tag};
  If(report("{Comment}", 1) != "") {$CountComment = 1;  $Comment = " AND cmt:" . $Comment};
	If ($CountLabel + $CountTag + $CountComment == 1) {$Temp = "*?" . $Label . $Tag . $Comment ; $Search = replace($Temp, " AND "); Tab("new"); goto "$Search"};
	Elseif ($CountLabel + $CountTag + $CountComment > 1) {$Temp = "*?:" . $Label . $Tag . $Comment ; $Search = replace($Temp, ": AND ", ":"); Tab("new"); goto "$Search"};
	Else {Status Selected item has neither Label nor Tag nor Comment,,"stop"}
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: Find all tags

Post by eil »

tried the script and it works weird. i selected few files, but "search" opened much more.. :eh: tried in in other locations and it happens too. btw, it checks only items in view?(no scan in child folders)
07-17_120655.png
07-17_120655.png (14.07 KiB) Viewed 6730 times
07-17_120739.png
07-17_120739.png (38.02 KiB) Viewed 6730 times
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Find all tags

Post by highend »

And now we make a quiz out of it, which of the three posted scripts you've used? :whistle:
One of my scripts helped you out? Please donate via Paypal

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

Re: Find all tags

Post by eil »

my bad, the last one. :roll: it seemed to me it uses faster method advised by Don: not searching through all items, but check database for lines with files of interest = am i right or wrong?

actually i'm in need of modified version of this script = check selected files and folders(sub included), popup a question "Tags/Labels/Comments present. View?" and if Yes open SearchTab(No do nothing).
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Find all tags

Post by highend »

Code: Select all

    $items = "";
    foreach($item, "<get SelectedItemsPathNames |>") {
        if (exists($item) == 1) { $items = $items . $item . "|"; }
        else { $items = $items . $item . "|" . folderreport("items", "r", $item, "r", , "|") . "|"; }
    }
    $items = formatlist($items, "de");

    $tags     = formatlist(report("{Tags} | ", $items), "de", " | ");
    $labels   = formatlist(report("{Label} | ", $items), "de", " | ");
    $comments = formatlist(report("{Comment} | ", $items), "de", " | ");

    $tag = ""; $label = ""; $comment = "";
    if ($tags)     { $tag = "tags:$tags"; }
    if ($labels)   { $label = ($tags) ? " OR lbl:$labels" : "lbl:$labels"; }
    if ($comments) { $comment = ($labels) ? " OR cmt:$comments" : (($tags) ? " OR cmt:$comments" : "cmt:$comments"); }

    if ($tags || $labels || $comments) {
        if (confirm("Tags/Labels/Comments present. View?")) { $temp = "<curpath>?" . $tags . $label . $comment; tab("new"); goto "$temp"; }
    } else { status "Selected items neither have a tag, label or comment", ,"stop"; }
One of my scripts helped you out? Please donate via Paypal

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

Re: Find all tags

Post by eil »

highend your variant starts search for whole PC. i select items on F:\ and after Ok it searches starting from C:\.
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Find all tags

Post by highend »

It uses <curpath> instead of *. Copy the script again.
One of my scripts helped you out? Please donate via Paypal

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

Re: Find all tags

Post by eil »

highend i feel a bit like a jerk, cause again it's not the goal - now it searches <curpath> while i need to check only selected. maybe search is not a good way here? variable should already have list of items of interest and all that is left is to show them..
i need such script to quickly check if selected items have some tags/labels/comments before making further operations. that why Confirmation is asked- to view list or just to know that items are present. basically i don't really need new it in tab, but text command doesn't provide color view as i know.
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Find all tags

Post by highend »

Em? The files / folders that you are selecting use a common path, the <curpath>. So ofc it starts it's search in that path and finds all those items that have either a tag, a label or a comment. I don't see the problem...
One of my scripts helped you out? Please donate via Paypal

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

Re: Find all tags

Post by eil »

they don't really share path all the time, that's exactly why i need to make all this about selected items only(script ought to be used not only in List, but in Flat and Search results too).
for ex: i have 10 folders with photos and going to move 2, i select those 2 and want to know if i tagged/etc anything there(and only in these 2).
another ex: i sorted items by size in drafts to free some space, selected first 50 and going to delete them -so i want to know if there some important files/folders among them.
please forgive me if i already got you bored or irritated. :mrgreen:
Win 7 SP1 x64 100% 1366x768

Post Reply