Page 1 of 1

Labels and Tags confusion

Posted: 14 Feb 2019 02:34
by zmachine01
I've been trying to better figure out how tags and labels work and what the difference is between them. I don't understand what it means to "add" a tag to a file/folder and to "set." I did some experimenting by adding/applying some tags to a couple files and then saving the tag data using the 'savesettings 64 "trashme.ini";' string, since I do not save my main settings or config while exiting XYplorer. When I exit XY and come back, the "Tag List Is Empty." Yet when I search with "Find All," the files I tagged in the last session are returned in the search. So there are tags, they just don't show up in the tag list. Plz see attachment

??
Thanks

Re: Labels and Tags confusion

Posted: 14 Feb 2019 07:05
by bdeshi
zmachine01 wrote: 14 Feb 2019 02:34I don't understand what it means to "add" a tag to a file/folder and to "set."
Say "The Fountainhead - Ayn Rand.pdf" had these tags: fiction, philosophical.
After adding the tags "individualism", "objectivism" the file's taglist becomes: "fiction, individualism, objectivism, philosophical".
After setting the tags "doorstop", "pages and more pages", the file's taglist becomes: "doorstop, pages and more pages".

Re: Labels and Tags confusion

Posted: 14 Feb 2019 07:11
by bdeshi
zmachine01 wrote: 14 Feb 2019 02:34I did some experimenting by adding/applying some tags to a couple files and then saving the tag data using the 'savesettings 64 "trashme.ini";' string, since I do not save my main settings or config while exiting XYplorer. When I exit XY and come back, the "Tag List Is Empty." Yet when I search with "Find All," the files I tagged in the last session are returned in the search. So there are tags, they just don't show up in the tag list.
The "tag list" doesn't list all existing tags (they're saved in the tag database, tag.dat), it's just a list of the tags you've manually entered. It's there to save you the trouble of typing out recently applied tags repeatedly. but since the list is saved in <xyini>, and you're not saving the ini, XY will forget it upon restart.

[ed.]
The disassociation between the taglist and the tag database is intended. You can set up different tag lists for different occasions. You can preseed the list with tags that you intend to apply to files in the near future. Anyway, populating the taglist with all existing tags is not implemented for performance reasons probably, but you can use this script to do so. Just run it after starting XY.
Open Main Menu > Scripting > Run Script, copy-paste the code into the text box and press OK.

Code: Select all

  $tagdb = tagexport("<xydata>\Temp\tagdb","");
  $tagdb = readfile($tagdb);
  $taglist = taglist();
  $header = 0;
  foreach ($record, $tagdb, <crlf>) {
    if ($header == 0) {
      if ($record == 'Data:') {
        $header = 1;
      }
    }
    elseif ($header == 1) {
      $tags = gettoken($record, 3, '|');
      if !($tags) { continue; }
      foreach ($tag, $tags, '; ') {
        if !(gettokenindex($tag, $taglist, '; ')) {
          $taglist .= "; $tag";
        }
      }
    }
  }
  taglist(regexreplace($taglist, '^[; ]+'));
  #881;
The script will open the "Add Tags..." dialog at the end, you don't have to do anything there, just ensure the "Add new tags to tag list" option is checked and click OK.

Re: Labels and Tags confusion

Posted: 14 Feb 2019 20:19
by Papoulka
Tags for "Atlas Shrugged" will be the same, except in all-caps. Shouldn't be a problem here, though.

Re: Labels and Tags confusion

Posted: 15 Feb 2019 00:16
by zmachine01
Thanks for the info. I'm starting to think I might need to approach my broader issue in a different way. I will post to the main forum