Skip to content

Copy attachment paths #404

Closed Answered by rdiaz02
rdiaz02 asked this question in Q&A
Discussion options

You must be logged in to vote

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.U…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rdiaz02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant