-
Is it possible to copy, to the clipboard, the path of any attachment? Like Zutilo's "Copy attachment paths". (I've not been able to find it here, nor in https://forums.zotero.org/discussion/108833/zutilo-in-zotero-7-which-of-its-functions-are-most-essential/p1). (I've found #195 , Copy attachments to the clipboard, but (a) It does not work for me; (b) I do not want the attachment, just the path) |
Beta Was this translation helpful? Give feedback.
Answered by
rdiaz02
Oct 16, 2024
Replies: 1 comment
-
This seems to work. I know no JS, but hacked if from a couple of scripts // Modified from
// https://github.com/windingwind/zotero-actions-tags/discussions/359#discussioncomment-10427641
// https://github.com/windingwind/zotero-actions-tags/discussions/397
if (!items?.length) return;
async function getAttachmentPath(item) {
if (item.isAttachment() && !item.isNote()) {
return await item.getFilePathAsync();
} else if (item.isRegularItem() && !item.isAttachment()) {
let attachment = await item.getBestAttachment();
return await attachment.getFilePathAsync();
}
return null;
}
items.forEach(async (item) => {
const filePath = await getAttachmentPath(item);
Zotero.Utilities.Internal.copyTextToClipboard(filePath);
}); Of course, suggestions/improvements welcome! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rdiaz02
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to work. I know no JS, but hacked if from a couple of scripts