Skip to content

How to add a code to open the folder where the PDF is located? #436

Answered by ramonmi
Sinoftj asked this question in Q&A
Discussion options

You must be logged in to vote

Event: None
Operation: Script
Shortcut: None
Name: Open PDF location

/**
 * @reference  https://github.com/windingwind/zotero-actions-tags/discussions/132
 * @usage Open the folder of the PDF attachment in Default Explorer
 * @link https://github.com/windingwind/zotero-actions-tags/discussions/436
 * @see https://github.com/windingwind/zotero-actions-tags/discussions/436
*/

if(!item) return;

const window = require("window");
const ZoteroPane = require("ZoteroPane");

// 如果是PDF,直接打开路径
if (item.isAttachment() && !item.isNote() && item.attachmentContentType === 'application/pdf') {
    ZoteroPane.showAttachmentInFilesystem(item.id);
	return "打开成功";
}
// 如果是父条目,查找其PDF附件并打开所在路径
else if (item…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Sinoftj
Comment options

@ramonmi
Comment options

Answer selected by Sinoftj
@Sinoftj
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants