Function ID for 'Find by Tags'?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Function ID for 'Find by Tags'?

Post by kiwichick »

Hi there, There Function IDs for Add/Set/Remove Tags but there doesn't appear to be one for Find by Tags. Am I missing something? Could a Function ID be added or what script commands would I use? Using Help I have this:

goto "C:\my path?tag:*";

It returns all the tagged files within the specified location but I can't figure out what commands I then need to make it search for particular tags, or invoke the Find by Tags Tag List ("Tick the tags that shall be matched").
Windows 10 Pro 22H2

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

I'm still struggling with this.

Is this just a type of search that I can store a template to? I can't figure out how to do that, though.

I thought I could use selfilter. It will, of course, work on the Tags [column] but I can't make it work using a variable for the [pattern]. Can this be done?

Or am I way off base either way? What I want to do is invoke the tag list as it appears when:

1. Selecting 'Tag List ...' in the 'Find by Tags' button dropdown.

or

2. Clicking the 'Select Tags ...' button in the Info Panel 'Find Files/Tags'.
Windows 10 Pro 22H2

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

Re: Function ID for 'Find by Tags'?

Post by serendipity »

Maybe something like this will work for you:

Code: Select all

  $input=inputselect (TagList, getkey ("TagsList", "Settings"),",",2); 
  $input=replace($input, ",", "|");
  $menu= popupmenu ("Current Folder|Everywhere");
  IF($menu==Current Folder){
                                      goto "<curpath>?tags:"$input" /rv";
                                     }
  ELSEIF($menu==Everywhere){
                                      goto "%computer%?tags:"$input" /rv";
                                      }
  ELSE{
          end 1==1;
         }

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

Hi there, thanks very much for that. It's definitely a start - The Tag List appears, I select the Tag and press OK, Current Folder/Everywhere menu appears, but no results are returned for either the Current Folder or Everywhere.

EDIT: So, as in my previous post, it appears to be a problem with using a variable in the ?tags: command. The $input variable doesn't work but replacing $input with a tag name will get results.

EDIT: Oooh forgot to ask. What does /rv do?
Windows 10 Pro 22H2

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

Re: Function ID for 'Find by Tags'?

Post by serendipity »

kiwichick wrote:Hi there, thanks very much for that. It's definitely a start - The Tag List appears, I select the Tag and press OK, Current Folder/Everywhere menu appears, but no results are returned for either the Current Folder or Everywhere.
EDIT: So, as in my previous post, it appears to be a problem with using a variable in the ?tags: command. The $input variable doesn't work but replacing $input with a tag name will get results.
Hmmm don't know whats wrong, work here.
kiwichick wrote: EDIT: Oooh forgot to ask. What does /rv do?
r= recurse subfolders.
v=verbatim i.e. will ignore wildcards like * and ?. useful if you have want to search tags which have * or ? in them. eg. "delete?" or "important*" will be searched verbatim.

Edit: see help>Main topics>find files and go to "Wildcards in Tags" section.

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

serendipity wrote:Hmmm don't know whats wrong, work here.
Strange, the Tag List that appears when using your script is not the same Tag List that appears when calling it by any other means. And any Tags I add to files aren't being added to the list your script calls :veryconfused:
serendipity wrote:see help>Main topics>find files and go to "Wildcards in Tags" section.
Ah, no wonder I couldn't find it - I wasn't looking in that part of the Help file :kidding:
Windows 10 Pro 22H2

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

Re: Function ID for 'Find by Tags'?

Post by serendipity »

kiwichick wrote:
serendipity wrote:Hmmm don't know whats wrong, work here.
Strange, the Tag List that appears when using your script is not the same Tag List that appears when calling it by any other means. And any Tags I add to files aren't being added to the list your script calls :veryconfused:
That's expected, my method directly reads taglist from xy's config file. Better would be to read the tags.dat file. I should have mentioned that before, sorry.
The script was just to show that it can be done. I think there are some scripts around which read tags.dat directly.

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

serendipity wrote:my method directly reads taglist from xy's config file. Better would be to read the tags.dat file.
Ah that makes sense and absolutely explains similar behaviour with other tagging scripts I have. I'm getting them to read the Tags List and not the database. So the Tags List and tag.dat don't synchronize their entries. Interesting, I wondered why the Tag List didn't reflect the actual tags items have. But, that being said, I am looking for tags that appear in both the Tags List and in tag.dat entries (30,000 in some cases).

C:\database test\clipboard.txt|0|banana, soap, wheelbarrow||||

TagsList=1980, 1987, abacus, ABBA, auction, back, baggage, balance, balloon, bamboo, banana, bandaid, bank, barcode, battery

As you can see both contain the 'banana' tag but when I use your script and choose banana no results are found - searching Current Folder or Everywhere makes no difference.
Windows 10 Pro 22H2

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

Re: Function ID for 'Find by Tags'?

Post by serendipity »

Can you try the script with step mode and paste the code here when you reach goto command?

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

Yip, definitely not right. This is, again, selecting banana in the Tag List - and I can see banana in the Tag List when it appears in Step Mode's 'Current command (parsed and resolved)' panel.

Code: Select all

goto
"C;\databasetest?tags:"" /rv"
If I edit the script replacing "$input" with "banana" results for banana are found and the command is resolved correctly:

Code: Select all

goto
"C;\databasetest?tags:"banana" /rv"
Windows 10 Pro 22H2

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

And, if it helps, on the "This view is empty" search tab, the "Copy Location Term" is:

C:\database test?tags:" banana" /rv

So where does the space between " and b come from because that seems to be the problem. If I do a Tag Search in the Info Panel for (space)banana I get no results, if I do banana I get results. And then the Copy Location Term is:

C:\database test
Windows 10 Pro 22H2

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

Go it!!!!

Code: Select all

$input=replace($input, ",", "|");
Your script has the separator as "," but it should be ", ".

Changed and running like a gem!!!! Woot woot, go me!!!
Windows 10 Pro 22H2

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

Re: Function ID for 'Find by Tags'?

Post by serendipity »

OK, added trim space now.

Code: Select all

  $input=inputselect (TagList, getkey ("TagsList", "Settings"),",",2); 
  $input=replace($input, ",", "|");
  $input= formatlist($input, "t");
  $menu= popupmenu ("Current Folder|Everywhere");
  IF($menu==Current Folder){
                                      goto "<curpath>?tags:"$input" /rv";
                                     }
  ELSEIF($menu==Everywhere){
                                      goto "%computer%?tags:"$input" /rv";
                                      }
  ELSE{
          end 1==1;
         }


kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

Awesome!!!! Thank you sooooooooo much :appl:


And I'd put the wrong line of code above with the missing space - it should have been the 'inputselect' line not the 'replace' one :oops:
Windows 10 Pro 22H2

kiwichick
Posts: 559
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Function ID for 'Find by Tags'?

Post by kiwichick »

Hi Don, Is there any chance you might consider adding Function IDs for the Find Tags features? Cheers :biggrin:
Windows 10 Pro 22H2

Post Reply