Page 1 of 1

[solved] Using script to rename file, then tag file, will not update the tag.data file

Posted: 10 Jun 2021 16:13
by wenmin92
Using script to rename file, then tag file, even if the "Save changes to disk immediately" was checked, the tag.data file will not update the tag. And, the following separete tag operation will all fail(could not update the tag.data fiile), even if it is for other files.
If I want to force update(write) the tag.data file, I have to click "save settings" menu or exit XYplorer.
For example:

Code: Select all

"test1"
  $file = get('SelectedItemsPathNames');
  $file = renameitem('temp01.txt', $file); // work
  tagitems('tag', 'test1', $file); // not work

// it's ok
"test2"
  $file = get('SelectedItemsPathNames');
  tagitems('tag', 'test2', $file);
  $file = renameitem('temp02.txt', $file);

// test1, then test3, not work
// test2, then test3, it's ok
"test3"
  $file = get('SelectedItemsPathNames');
  tagitems('tag', 'test3', $file);

Re: Using script to rename file, then tag file, will not update the tag.data file

Posted: 10 Jun 2021 16:25
by highend
No, when you want to save the tag database after scripts have modified something you don't need to click on anything, you let the script do the job^^

savesettings 64;

E.g.:

Code: Select all

  $file = get('SelectedItemsPathNames');
  $file = renameitem('temp01.txt', $file);
  tagitems('tag', 'test1', $file);
  savesettings 64;
Which works fine here...

Re: Using script to rename file, then tag file, will not update the tag.data file

Posted: 10 Jun 2021 16:30
by wenmin92
highend wrote: 10 Jun 2021 16:25 No, when you want to save the tag database after scripts have modified something you don't need to click on anything, you let the script do the job^^

savesettings 64;

Which works fine here...
Oh, I forgot to search the api doc to find a way to save settings. Thanks.