Download bibliographic metadata

exiftool is not part of the standard installation on a Mac. You should make a note to people this is a required dependency in your script.

Thanks for sharing your script! Unfortunately I could not get it to work properly over here.
For some reason it is taking data from another reference in Bookends, other than the one I have selected, and throwing it at the selected reference in DT3. I will dig around to see if I can find the cause of this.

There are some assumptions with the script that I didn’t clarify. The first is that DEVONthink is indexing the Bookends folder where attachments are stored. The second is that there is only one attachment in the selected Bookends reference.

Having used several bibliography database programs, I kept returning to one I’ve used for decades now (Endnote). So I use it in conjunction with DevonThink for searching, with DevonThink doing its great job of indexing. The smart group feature allows me to grab all types of attachments from my bibliography database. I’m not aware of an Endnote script that could work for the variety of reference types I use, but I could easily be missing something.

This is fantastic.:smiley: Any possibility of modifying the script to import highlighted text as well, pls?

doclrb

Yes, have a look at the second script on this thread. It will import Bookends notecards.

Great! TY

doclrb

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

Is exiftool something one can trust? Any known problems after it is installed?

Phil Harvey’s exiftool has been around and in development for a long time.

Do note: if you’re creating scripts to share here or elsewhere, you should disclose any such dependencies… or better yet, avoid them and write native methods to do the same thing whenever possible.

Another question. Will this run under Devonthink Pro Office 2? When I try to compile I receive at erro message at ‘custom data’.

TY

doclrb

Will this run under Devonthink Pro Office 2?

No. Custom meta data is a DEVONthink 3 feature.

OK. So how do I upgrade to the Pro 3 Beta from my DevinThink Pro Office license from the app store.

TY

Les

There is no “DEVONthink Pro Office license from the app store”. Pro Office is not sold on the App Store (and actually never has been).

We recently blogged about using your customer account. I would suggest starting there, regrading upgrades:

However, remember: DEVONthink 3 is in beta testing meant for testing, finding and reporting bugs. It should not be used in mission-critical or production environments.

When beta testing, it’s always wise to use copies of data or test data. I personally also advocate running DEVONthink 3 on a separate macOS User account to keep things isolated. Your data, your choice - but I always err on the side of caution with peoples’ data.

OK. I stand corrected. I have a valid license and have previously forwarded to sales, but it is not listed in my account, hence my my confusion. In order to upgrade my account I imagine it would have to be listed there, but it is not. So can we start by taking steps to list my license in my account? The appropriate steps should follow from there,

Please go to https://www.devontechnologies.com/support/supportcenter and contact Heike regarding sales and your account. Thanks!

Thanx again for providing the script. I have muddled my way through the DT3 beta upgrade and compiling and inserting the script. When I run it, a highlighted ref is pulled in to DT3 and an ‘Annotations’ subhead is created, but I do not see any highlighted text. I’m so close. What am I missing here? I believe it has something to do with the notecard feature in Bookends. Would really appreciate guidance.

TY

doclrb

GOT IT. One must specifically ‘Add the highlights to Bookends’ and it works ike a charm!

TY

doclrb

Glad it worked out for you

Like the Import > References from Bookends... command, can the script be modified so that it only updates/ignores already created .rtf files instead of adding duplicates? Since I’ve no experience with Apple Script any help is really appreciated.

Thanks.