Page 1 of 2
Find all tags
Posted: 06 Jan 2013 10:56
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
Re: Find all tags
Posted: 06 Jan 2013 11:23
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"
Re: Find all tags
Posted: 06 Jan 2013 11:35
by binocular222
My script searchs for Label, Comment also, not just Tags
Re: Find all tags
Posted: 06 Jan 2013 12:22
by admin
Yes, I just wanted to show the use of some functions.
Re: Find all tags
Posted: 06 Jan 2013 16:41
by Kees54
This is what I want!
Thanks a lot, it works both!
Re: Find all tags
Posted: 06 Jan 2013 16:43
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"}
Re: Find all tags
Posted: 17 Jul 2015 11:23
by eil
tried the script and it works weird. i selected few files, but "search" opened much more..
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 (14.07 KiB) Viewed 6733 times
- 07-17_120739.png (38.02 KiB) Viewed 6733 times
Re: Find all tags
Posted: 17 Jul 2015 11:33
by highend
And now we make a quiz out of it, which of the three posted scripts you've used?
Re: Find all tags
Posted: 17 Jul 2015 11:42
by eil
my bad, the last one.
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).
Re: Find all tags
Posted: 17 Jul 2015 12:52
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"; }
Re: Find all tags
Posted: 17 Jul 2015 13:23
by eil
highend your variant starts search for whole PC. i select items on F:\ and after Ok it searches starting from C:\.
Re: Find all tags
Posted: 17 Jul 2015 13:26
by highend
It uses <curpath> instead of *. Copy the script again.
Re: Find all tags
Posted: 17 Jul 2015 13:56
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.
Re: Find all tags
Posted: 17 Jul 2015 14:01
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...
Re: Find all tags
Posted: 17 Jul 2015 14:19
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.