Forked from zverhope/bookends-index_unlinked_group_dtpo.scpt
Last active
July 13, 2023 16:28
-
-
Save DesBw/568400abefda0381057ddd4bbdf04e52 to your computer and use it in GitHub Desktop.
I changed the format from RIS to BibTeX & Removed the part that writes XML to the pdf because I have already done that using Jabref (which is much faster and more effective to write XML to the pdf files)
This file contains 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
tell application "Bookends" | |
tell front library window | |
set theIDs to get id of publication items of group item "UnlinkedAttach" | |
repeat with theID in theIDs | |
try | |
set myRefs to (publication items whose id is theID) | |
set myItem to first item of myRefs | |
set {theKey, thePath} to {citekey, path of attachment items} of myItem | |
set theBIB to format myItem using "BibTex.fmt" | |
set otid to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to linefeed | |
set thePath to text items of thePath | |
repeat with i in thePath | |
set thisPath to i as string | |
tell application "Finder" to set theName to name of (POSIX file thisPath as alias) | |
set AppleScript's text item delimiters to otid | |
tell application id "DNtp" | |
set theDatabase to open database "Users/dwo000/Documents/Databases/DevonThink/Ling.dtBase2" | |
set theLocation to create location "/Sources/@articles" | |
set theRecord to indicate thisPath to theLocation | |
set URL of theRecord to ("bookends://sonnysoftware.com/" & theID) as text | |
set aliases of theRecord to theKey | |
set comment of theRecord to theBIB | |
set theLink to reference URL of theRecord | |
end tell | |
end repeat | |
set user20 of myItem to theLink | |
on error errorMessage | |
end try | |
end repeat | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find no better script than this to link DEVONthink and Bookends.
Thank you Zach.