Scripting to replace catalog click and search

Discuss and share scripts and script files...
Post Reply
aubrey97
Posts: 48
Joined: 22 Jun 2013 11:27

Scripting to replace catalog click and search

Post by aubrey97 » 20 Mar 2019 11:25

I have found that the only reason I have to use the catalog is for click and search, so I want to regain that screen-estate.

I am using the following scripts on a button to deal with tags (all from this forum or adapted for my use):

To replace click and tag:

Code: Select all

$tags = taglist();
    if !($tags) { status "No tag(s) in taglist, aborted!", "8B4513", "stop"; end true; }
    $tags = regexreplace($tags, "(.+?)(,|$)", "$1|$1|:tagsadd,");
    $sel = inputselect("Choose tag(s) to apply", $tags, ",", 1+2+32+64+1024, , 300, 600);
    tagitems("tags", $sel);
To replace click and search whole computer with OR option

Code: Select all

$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"
To replace click and search this location with OR option

Code: Select all

$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 "<curpath>?tags:""$tags"" /rv"
To replace click and search this location with AND option

Code: Select all

$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 "<curpath>?tags:""$tags"" /rv"
To replace click and search whole computer with AND option

Code: Select all

$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"
My only remaining things to do are:

a) To do the same for labels (obviously only the OR option here) -- but I can't work out how to bring up labels in a list

b) To do AND/OR option for a combination of labels and tags -- in other words can I bring up some sort of a list that will contain all labels and tags. I could do this in the catalog. i.e. I want to be able to search for items that are labelled "Urgent" and have tag "dog"... Any help would be appreciated.

Should this stuff not be inbuilt?

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

Re: Scripting to replace catalog click and search

Post by highend » 20 Mar 2019 11:40

Labels are defined in the tag.dat file so you gather them from there

Code: Select all

    $labels = gettoken(gettoken(readfile("<xytagdat>"), 2, "Labels:<crlf>"), 1, <crlf>);
    $labels = trim(regexreplace($labels, "\|\|[A-F0-9]{6};?", ",", 1), ",", "R");
    text $labels;
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

aubrey97
Posts: 48
Joined: 22 Jun 2013 11:27

Re: Scripting to replace catalog click and search

Post by aubrey97 » 20 Mar 2019 12:03

That's great - thank you greatly. I will see what I can do with that and report back for others to use. Is there an easy way to eliminate labels that start with Unused* ?

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

Re: Scripting to replace catalog click and search

Post by highend » 20 Mar 2019 12:16

regexreplace()?
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Post Reply