批量修改字段

举例子
把专利的国家都改成中国,先把语言其换成英文,然后看到专利是 Patent,国家字段是 Country,然后写个 json 文件 {“itemType”:”Patent”,”country”,”中国”},复制后选中要修改的条目,然后右键操作就行。注意大小写敏感。

  1. {"itemType":"patent","country","中国"}

上面的代码不行了,改用最直接的,运行 JavaScrip 脚本。

  1. zoteroPane = Zotero.getActiveZoteroPane();
  2. items = zoteroPane.getSelectedItems();
  3. var rn=0; // 计数
  4. var country="中国"; // 替换部分
  5. for (item of items){
  6. var co=item.getField("Country");
  7. if(co==""){
  8. item.setField("Country",country);
  9. rn+=1;
  10. await item.saveTx();
  11. }
  12. }
  13. return rn+"个条目国家替换为"+co+"."