Improving Scrivener ⬄ Bookends Integration

I attach a couple of scripts (Jon the developer of Bookends wrote one and I modified it to create the other) to ease interaction between Scrivener (or any other app) and Bookends.

[size=150]Quick Search Formatted/Unformatted Ref[/size]
The first takes a text selection in Scrivener, that is a formatted or unformatted ref, removes unnecessary text/characters and searches for it within bookends using the Live-Search field

If I have text like:

(Hubel and Wiesel, 1962)

it strips [u, and[/u]] to leave [Hubel Wiesel 1962], which finds that reference in bookends instantly. A simple ⌘Y and that selected text gets replaced with the proper temporary citation without any further fiddling. It works with existing temporary citations too, so:

{Shipp et al., 2013, #54808}

gets converted to [Shipp 2013] Live-Search to quickly check the source reference in Bookends.

[size=150]Search selected text in Pubmed[/size]
The second takes a text selection, and pastes it into Bookends Pubmed search engine. Again it works in any app not just Scrivener. it means I can select an author or some words and quickly run a pubmed search. For it to work optimally, it needs Bookends 12.7 beta (introducing the new cloud sync) and later to work, as Jon made a small change to the Pubmed browser to make it more reliable.

[size=150]How to use them?[/size]
Find them attached:

Bookends (7.98 KB)

As they are Applescripts they normally live in ~/Library/Scripts, but to quickly access them you need some way to trigger them. I use the wonderful Quicksilver, which automatically indexes ~/Library/Scripts, so you can easily trigger these scripts wherever you are. Alfred/Launchbar/Keyboard maestro and others also allow you to quickly trigger Applescripts, though each may do so in a slightly different way. OS X also has a built-in scripts menu you can display (Script Editor > Preferences to enable it); you then run them from the menu bar.

[size=150]See the raw code:[/size]

Thanks for this, @nontroppo. I’ve downloaded it so I can have a look. Given I’ve retired, I am unlikely to need the second, but you never know; on the other hand, I can just see myself using the first. Also, I don’t have Alfred/KM/Quicksilver—at least I tried Quicksilver several years ago but didn’t get into it and abandoned it—but with the applescript menu, one might be able to set a keyboard shortcut through System Preferences.

But whether it’s of use to me or not, thank you for taking the trouble. :slight_smile:

Mr X

You’re welcome. I wish Spotlight would index scripts, it seem obvious to me but Apple works in mysterious ways…

I’m using the first script a lot, it is really helpful to quickly find a reference in my database from a PDF/word doc/browser/scrivener. I also seem to live in pubmed at the moment, I have the search modifiers burnt into my memory!

One slight wrinkle with these scripts is that they work in every app, except Bookends itself. This may seem unnecessary, but often I want to select some text from an abstract of one ref and quickly run a pubmed search, or an author search of the other refs in my database, but I have to do that manually. The reason is bookends deliberately saves every text field when it defocusses, thus it loses the selection before the script can run.