Replies: 1 comment
-
This script will create a reminder to add tags. The prompt will show the title of the item that was just closed and will only display a prompt if that item has no tags. The Actions and Tags plugin supports the event Close Tab, there is no option for Close Window. So it won't work if you have the setting enabled to use windows instead of tabs. const Zotero = require("Zotero");
(async function() {
try {
// Log the trigger type for debugging purposes
Zotero.logError(`Trigger type: ${triggerType}`);
// Ensure an item is provided when the PDF tab is closed
if (!item) {
Zotero.logError("No item was provided. Ensure the script is triggered by a single item (e.g., a PDF being closed).");
return;
}
// Get the item's title and tags
let title = item.getField('title') || "Unknown Title";
let tags = item.getTags();
// Check if there are no tags, and prompt the user to add them
if (tags.length === 0) {
Zotero.alert(null, "Tag Reminder", `Don't forget to add tags to the paper you just read: "${title}"`);
} else {
Zotero.logError(`Item "${title}" already has tags.`);
}
} catch (error) {
// Log any errors that occur
Zotero.logError(`Error displaying tag reminder: ${error.message}`);
}
})(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think it would be helpful to have the user automatically prompted to add tags after closing a paper. I often forget to add tags after reading, and then have to remember what the paper is about :)
Beta Was this translation helpful? Give feedback.
All reactions