Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
dev:client_coding:javascript_api [2020/10/17 20:58] – [Batch Editing] dstillmandev:client_coding:javascript_api [2020/10/17 21:05] – [Batch Editing] dstillman
Line 356: Line 356:
  
 Before proceeding, back up your [[:zotero_data|Zotero data directory]] and temporarily disable auto-sync in the Sync pane of the Zotero preferences. Before proceeding, back up your [[:zotero_data|Zotero data directory]] and temporarily disable auto-sync in the Sync pane of the Zotero preferences.
 +
 +All examples operate on the currently selected library.
  
 ==== Example: Item Field Changes ==== ==== Example: Item Field Changes ====
Line 367: Line 369:
 var fieldID = Zotero.ItemFields.getID(fieldName); var fieldID = Zotero.ItemFields.getID(fieldName);
 var s = new Zotero.Search(); var s = new Zotero.Search();
-s.libraryID = Zotero.Libraries.userLibraryID;+s.libraryID = ZoteroPane.getSelectedLibraryID();
 s.addCondition(fieldName, 'is', oldValue); s.addCondition(fieldName, 'is', oldValue);
 var ids = await s.search(); var ids = await s.search();
Line 397: Line 399:
    
 var s = new Zotero.Search(); var s = new Zotero.Search();
-s.libraryID = Zotero.Libraries.userLibraryID;+s.libraryID = ZoteroPane.getSelectedLibraryID();
 s.addCondition('creator', 'is', oldName); s.addCondition('creator', 'is', oldName);
 var ids = await s.search(); var ids = await s.search();
Line 422: Line 424:
 return ids.length + " item(s) updated";</code> return ids.length + " item(s) updated";</code>
  
-==== Example: Convert manual tag in selected library to automatic tag ====+==== Example: Convert Manual Tag to Automatic ==== 
 + 
 +Note that this will change all instances of the tag in the library.
  
 Replace "Foo" in the first line with the tag to change: Replace "Foo" in the first line with the tag to change:
dev/client_coding/javascript_api.txt · Last modified: 2022/07/02 18:22 by dstillman