Bookends to Obsidian with front matter filled

Hi all,

I am trying to set up a workflow with Bookends and Obsidian and I am looking for a script that takes the selected reference in Bookends and creates a new note in Obsidian with “Author Year Title” as name, and with “citation ID” (without the # first) as an alias in the front matter. Would any of your scripts, @ryanjamurphy, be possible to adjust to create this?

I tried combining Devonthink and Bookends last year (indexed the pdf folder), with the result that Bookend lost the link to half of the pdf’s in my library, so I am looking for an adapted version of the existing DT-BE-Obsidian script. I am not interested in having the notes exported as notes in Bookends and Obsidian serve different purposes.

Adding keywords (from BE) as tags in the front matter, and adding the link back to the BE reference would be nice, but not essential for me.

The citation ID in the alias is essential because it allows tracking all citations of the reference in Obsidian.

Thanks in advance for any help!

Ken

Off the topic here but I also had DT index my BE attachment folder on iCloud and that happened to me before. I was able to fix that by disabling the iCloud optimize storage setting.

1 Like

It should be doable. I don’t have the bandwidth to script it for you, but you’d be looking for something like the following (which isn’t strictly AppleScript, you’ll have to check with the appropriate AppleScript dictionaries on exact terms):

tell application "Bookends"
set selectedReferences to the selected Bookends publications
set theReference to the first item in selectedReferences -- assumes you've only selected one reference
set theAuthor to author of theReference
set theYear to year of theReference
set theTitle to title of theReference
set theID to bookends ID of theReference
set bookendsLink to "bookends://sonnysoftware.com/" & theID
set noteFilename to theAuthor & " " & theYear & " " & theTitle
set noteText to "---" & return &  "citation ID: " & theID & return & "bookendsLink: " & bookendsLink & return & "---"

tell application (some application that can create files—Finder, DEVONthink, etc.,) 
create new file with filename noteFilename and text noteText
end tell

Handling the keywords would involve getting the Bookends keywords, parsing them to make them into a comma-separated list, then using the same techniques above to put 'em into note YAML.

You might want to check in at Sonny Software’s forum for more detailed support. Technically this isn’t an Obsidian issue as the note you’re creating is just a markdown file in a folder somewhere—just one that Obsidian happens to pick up.

1 Like

Thanks @ryanjamurphy ! I am not skilled at coding but I’ll give it a go :+1:

1 Like