Download bibliographic metadata

Not sure if it’s useful but here’s a script similar to File > Import > References from Bookends. Contrary to the internal command the script imports only the selection and adds also custom metadata. And as it’s a script it can be customized of course.

-- Import selected Bookends references as rich text including tags & custom metadata

tell application "Bookends"
	tell front library window
		set theRefs to selected publication items
		repeat with theRef in theRefs
			set theID to id of theRef
			set theDOI to doi of theRef
			set thePMID to pmid of theRef
			set theISBN to isbn of theRef
			set theURL to url of theRef
			set theLanguage to language of theRef
			set theDate to publication date string of theRef
			set theCreationDate to date added of theRef
			set theModificationDate to date modified of theRef
			-- set theType to type of theRef
			
			set theTitle to title of theRef
			set theNotes to notes of theRef
			set theKeywords to keywords of theRef
			set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ASCII character 10}
			set theTags to text items of theKeywords
			set AppleScript's text item delimiters to od
			
			set theAuthors to authors of theRef
			set theEditors to editors of theRef
			set thePublisher to publisher of theRef
			set theJournal to journal of theRef
			set theVolume to volume of theRef
			set thePages to pages of theRef
			set theRating to rating of theRef
			set theCitation to user1 of theRef -- user1 is the Bookends field where BibTex citation is stored
			set theAbstract to abstract of theRef
			set theContent to format theRef using "Summary.fmt" as RTF
			set theFormattedReference to format theRef using "APA 6th Edition Markdown.fmt"
			
			(* repeat with theAttachment in attachments of theRef
				set theFile to the first attachment item of theRef
				set thePath to the path of theFile
				if thePath is not "" then
				end if
			end repeat *)
			
			tell application id "DNtp"
				set theRecord to create record with {name:theTitle, type:rtf, content:theContent, rating:theRating, comment:theNotes, tags:theTags, creation date:theCreationDate, modification date:theModificationDate} in current group
				
				set URL of theRecord to ("bookends://sonnysoftware.com/" & theID) as text
				add custom meta data theDOI for "doi" to theRecord
				add custom meta data thePMID for "pmid" to theRecord
				add custom meta data theISBN for "is?n" to theRecord
				add custom meta data theURL for "link" to theRecord
				add custom meta data theLanguage for "language" to theRecord
				add custom meta data theDate for "date" to theRecord
				-- add custom meta data theType for "type" to theRecord
				
				add custom meta data theAuthors for "authors" to theRecord
				add custom meta data theEditors for "editors" to theRecord
				
				add custom meta data thePublisher for "publisher" to theRecord
				add custom meta data theVolume for "volume" to theRecord
				add custom meta data theJournal for "journal" to theRecord
				add custom meta data thePages for "page" to theRecord
				
				add custom meta data theAbstract for "abstract" to theRecord
				add custom meta data theCitation for "citation" to theRecord
				add custom meta data theFormattedReference for "reference" to theRecord
			end tell
		end repeat
	end tell
end tell
3 Likes