Created
October 21, 2019 12:38
-
-
Save anjiro/9e9e86c751b10e93b94c07d5ab608156 to your computer and use it in GitHub Desktop.
Batch edit Zotero 5 items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Make batch changes to selected items in Zotero. Paste this into Tools -> Developer -> Run JavaScript. | |
async function batch_edit(field, value) | |
{ | |
var zp = Zotero.getActiveZoteroPane(); //Active Zotero window | |
var selected = zp.getSelectedItems(); //Get the items that are selected | |
for(const item of selected) | |
{ | |
item.setField(field, value); | |
await item.saveTx(); | |
} | |
} | |
//To check out the fields you can change, uncomment: | |
//return Zotero.getActiveZoteroPane().getSelectedItems()[0]; | |
//Now run, for example: | |
await batch_edit("date", "1957"); | |
return "Finished"; //This just prints "Finished" in the output window so you know it's done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment