pacmax beta

Alfred Pac by iandol on GitHub

bookends tools

Alfred Workflow to Integrate with Bookends, an academic reference manager/bibliography tool for macOS

From their README

Status: I don't really use this workflow anymore, I tend to use Bookend's native floating citations for writing and some Applescript snippets for selecting DOIs/arXiv links in my browser to quick add. There are still some useful scripts like the OPML generation I occasionally use. If things don't work I may not get round to fix for a while, so I would love it if someone forked and gave this some polish.

Bookends Tools

Bookends is an excellent bibliographic/research manager for macOS. This Alfred workflow curates around 11 tools together in one interface to integrate between Bookends and other apps. You can use Alfred keywords (be…) and/or your preferred key binding to trigger them (edit the Hotkey trigger). The workflow is designed for Alfred 3 and 4, and should keep itself up-to-date using OneUpdater.

Download it here…

Workflow screenshot

Note: the tools denoted by πŸ“„ utilise Applescript System Events to trigger keyboard bindings with delays; the delays work fine for me but may need to be adjusted for you. If the tools seems to not work try to manually type ⌘V and enter.

key: πŸ“„: select some text in another app then trigger tool β€” πŸ—„: select reference(s) within Bookends then trigger tool β€” ⌨: trigger tool and enter some text Β 

  1. beidsearch πŸ“„ β€” Find a selected uniqueID in Bookends. For example, if you have a temporary citation like {Koffka, 1922, #6475} in your word-processor, double-click select the Bookends ID 6475, then trigger this workflow and it will find the reference in Bookends for you.
  2. bebrowser πŸ“„ β€” Search selected text in Bookends browser. For the Pubmed interface you should select this manually in the bookends browser before triggering this tool. If the automatic paste into the search field fails, press ⌘V and ENTER to trigger the search.
  3. berefsearch πŸ“„ β€” Take selected text like "(Doe et al., 2005)" citation, clean it up to become "Doe 2005" and send it to Bookend's quick search. This is great because you can take a formatted ref in a text document and search for the first author/year, then quickly paste back (⌘Y for Scrivener) the Bookends style temporary citation in its place!
  4. bequickadd πŸ“„ β€” Take a selected DOI / PMID / ISBN / JSTOR in any application and send it to Bookend's Quick Add (added in Bookends 13.0.3+) to quickly add this reference to your database.
  5. betobibtex ⌨ β€” You enter the name of a Bookends static/smart group name and this will create a BibTeX bibliography file for those particular groups. Very useful for Pandoc and/or LaTeX workflows -- though note that recent Bookends versions can auto-sync the database to a BibTeX file (see tips here). You can optionally generate JSON. You can configure the export path in the workflow variables (default Desktop/). betobibtex
  6. betoopml πŸ—„ β€” Select multiple references within Bookends, then run this to create an OPML file which you can import into Scrivener or other OPML-aware tool. This will contain the abstract and notes which is very useful for research. It contains links back to the Bookends reference. You can configure the export path in the workflow variables (default Desktop/).
  7. bescopus πŸ—„ β€” Select a reference with a DOI in Bookends, then trigger this to search Scopus with that DOI. It will return an inline results list for the Scopus entry AND the Cited-by page if available. Select an entry to open that page. Environment variables: appendScopusNotes [true/false] β€” copy the URLs into the Notes field | scopusKey [value] if you have registered for your own key enter it here | scopusBaseURL [url] β€” If you got through a proxy, enter the URL base to replace https://www.scopus.com/. bescopus
  8. becite ⌨ β€” Activate becite in any application to search your bookends database with one or more author/editor names and an optional year (for example: friston hobson 2014), and get a floating inline results list. You can then select a result and paste the selected ref as a temporary citation (⌘ pastes Pandoc style, βŒ₯ pastes MMD style, βŒƒ pastes formatted ref, ⇧ open ref in Bookends, ⌘βŒ₯ open PDF directly, [fn] opens attachment in Bookends, β‡§βŒƒ copies the bookends:// link as text). For becite, betitle. and beall there is also a workflow environment variable (citeUsesRTF & commentText) to copy the Pandoc/MMD temporary citation using RTF; this puts the link back to bookends into an RTF comment (and/or annotation in Scrivener). becite
  9. betitle ⌨ β€” Enter one or more words contained in the title or keywords and an optional year, and get a floating inline results list. You can then paste this as a temporary citation (⌘ pastes Pandoc style, βŒ₯ pastes MMD style, βŒƒ pastes formatted ref, ⇧ open ref in Bookends, ⌘βŒ₯ open PDF directly, [fn] opens attachment in Bookends, β‡§βŒƒ copies the bookends:// link as text). betitle
  10. beall ⌨ β€” You enter one or more words contained in any field and an optional year, and get an inline results list. You can then paste this as a temporary citation (⌘ pastes Pandoc style, βŒ₯ pastes MMD style, βŒƒ pastes formatted ref, ⇧ open ref in Bookends, ⌘βŒ₯ open PDF directly, [fn] opens attachment in Bookends, β‡§βŒƒ copies the bookends:// link as text).
  11. bebib ⌨ β€” You enter one or more author/editor names and an optional year, and get an inline results list. You can then paste the selected ref as a formatted reference (see workflow variable citationStyle; ⌘ pastes Pandoc style, βŒ₯ pastes MMD style).
  12. beconvert πŸ“„ β€” This has a very specific use, say you have an author-date formatted intext citation (Barlow et al., 1963), select it and run this to get a temporary citation using the most likely BibTeX key [barlow1963]. It allows me to take an author-date formatted manuscript from someone else and as long as I have regular BibTeX keys [authoryear], manually converts the intext citations to a form Bookends or Pandoc can then scan, saving some time.

Workflow variables

variables

There are several workflow variables which let you modify the functionality of the tools:

  • tempCitationStyle : for becite / betitle / beall the default temporary citation style is Bookends (with key modifiers allowing Pandoc and MMD formats). However if you will never use the Bookends format, you can set tempCitationStyle to Pandoc / MMD / LaTeX and the default temp citation will be set accordingly.
  • attachmentsFolder : relative or absolute path to where your Bookends attachments are stored. This is used so that you can Quicklook results with PDF attachments from becite / betitle / beall tools (press [shift] or ⌘Y)
  • BibTeXtoJSON (default = FALSE): allows you to convert the BIB file to a JSON file, which at least for Pandoc-citeproc is much faster (~3X) to then process for the bibliography. Requires pandoc-citeproc for the conversion...
  • citeUsesRTF (default = FALSE) & commentText: for the becite and betitle tools for Pandoc/MMD temporary citations, if you enable this then the temp citation is copied as RTF with a comment-enclosed link back to Bookends. In Scrivener if you enable Preferencesβ–ΈSharingβ–ΈImport comments as inline annotations, then the comment becomes an inline annotation. commentText is the text that is linked back to Bookends (default is @). For bebib tool it will toggle whether the formatted ref is plain or RTF.
  • customExportFormat (default = EMPTY) : for betobibtex the default is to use the standard BibTeX.fmt export format. This includes abstract and addresses which are not always needed for bibliography generation. You can therefore specify a custom format, for example like this BibTeX-Minimal format, which omits these fields and results in a faster BibTeX generation and smaller resultant file.
  • protectBibTitles (default = FALSE): makes titles in the BIB file {{ wrapped }} so the case is not changed in subsequent processing.
  • citationStyle (default = APA 6th Edition): is the Bookends bibliographic style used by bebib when outputting the formatted reference.
  • exportPath (default = Desktop): used by betoopml and betobibtex
  • appendScopusNotes (default = FALSE): allows you to toggle the behaviour whereby the Scopus URLs are appended back into the Bookends reference note stream.
  • scopusKey: your personal Scopus API key (see below).
  • scopusBaseURL: If you use a proxy that changes the base URL, enter it here to replace the default .

Scopus Info

For the Scopus search tool, ideally you should register for your own Scopus API key (without it it will use the demo key which may or may not work) and enter it in the workflow variables. The Scopus URLs also benefit from an institutional subscription, otherwise you will see a Scopus preview (which still contains useful information). If your institution offers a proxy, then you can enter the scopusBaseURL variable to use that.

Sources

Several of these very useful tools have been modified from the following sources:

betoopml

Thanks to Dave Glogowski (dave83); Bookends forum thread

betobibtex

Thanks and MIT copyright to Naupaka Zimmerman; Bookends forum thread | Original Gist

becite & bebib

Thanks to kseggleton for the original applescript version; Bookends forum thread

OneUpdater

Thanks to Vitor for his excellent update system for Alfred workflows: OneUpdater

Latest release

  • 1.3.101 year ago, 1.0 MBDownload

    One of the JSON fields, uniqueID became lowercase in a recent BE update, which broke the insertion of temporary citations; adjust the code to handle this, hopefully backwards compatible.

18 earlier releases
  • 1.3.95 years ago, 1.0 MBDownload

    V1.3.9 β€” allow shift+control to copy the bookends:// link as text in becite, betitle and beall

    Full Changelog: https://github.com/iandol/bookends-tools/compare/V1.3.7...V1.3.9

  • 1.3.75 years ago, 1.0 MBDownload

    becite/betitle/beall/bebib: allow ⌘βŒ₯ [command][option] to open an attached PDF directly.

  • 1.3.65 years ago, 1.0 MBDownload
    • bebib: make sure this tool uses the citeUsesRTF Alfred environment variable so you can choose RTF or plain text output.
    • There is also a new tool, beconvert, which is only useful if you want to convert author-date formatted citations in e.g. Word (like (Barlow et al., 1963)) to temp bibtex key intext citations. This really depends on your BibTeX keys also conforming to [authordate], it will not work for other cases. It does check if the key exists in the bookends database, and if there are multiple possible keys (like barlow1963 / barlow1963a / barlow1963b) they will all be pasted in and you must select which is appropriate.
  • 1.3.56 years ago, 1.0 MBDownload

    betobibtex: Add a workflow variable customExportFormat which allows you to specify a customised BibTeX formatter, default is the builtin BibTeX.fmt, but for example you can make a modified format removing address and abstract that makes export faster and the resultant files much smaller. You can find my BibTeX-Minimal.fmt here: https://gist.github.com/iandol/b8649aa8375e59902f88f00c3c64c294 β€” download it and add it to your Bookends custom format folder, then set customExportFormat to the same name as this format, and this will be used. I suspect technically you can even specify any format, even non-BibTeX ones so could use this setting to hack exports to RIS etc.

  • 1.3.46 years ago, 1.0 MBDownload

    A few releases back (~V13.2), Bookends added a dedicated Quick Add[1] Applescript command. I couldn't get it to work in the background at the time and continued to use GUI scripting. Thanks to a hint from @bcdavasconcelos I realised it was a problem in my code, and this works fine in the background, so I upgraded bequickadd to use this more efficient and reliable command method.

    Also fixing #8 for betobibtex, if there is an error when pandoc-citeproc tries to convert the BibTeX to JSON, the user will be warned with a display notification and the BibTeX will not be deleted so the user can check it.


    [1] Quick add is the very nice feature when you can select a DOI/PMID/etc. number in any app (e.g. your browser, or PDF reader) and quickly add it to your bookends database without disrupting your workflow...

  • 1.3.36 years ago, 1.0 MBDownload
    • Update the applescript interface used to control Bookends to use the new events system that is faster.
    • Better error checking when fetching the scopus API data, and working round an annoying Ruby error when the system proxy is set,
    • Added a new environment variable scopusBaseURL to specify a replacement base url prefix, if for e.g. you access Scopus through a proxy. For example, the default address is https://www.scopus.com but my institution accesses through https://www-scopus-com-443.webvpn.las.ac.cn/ so I set that and URLs get rewritten to use the new base URL.
  • 1.3.27 years ago, 1.0 MBDownload

    Small fix for betoopml…

  • 1.3.17 years ago, 1.0 MBDownload

    1.3.1 β€” bequick: don't "hide" bookends, rather refocus previous app…

  • 1.3.07 years ago, 1.0 MBDownload

    bequick: small tweak to hide bookends after triggering "quick-add", giving focus back to your browser.

  • 1.2.98 years ago, 1.0 MBDownload
    • I've added a new workflow variable tempCitationStyle that sets the default (pressing return directly) temporary citation format for becite / betitle / beall. When unset it will be the default Bookends standard {author,year,#id}, but you can set the variable to Pandoc / MMD / LaTeX to paste the citation in a different format ([@key] / [#key] / \\cite[]{key}). This adds more possible formats than is possible with using the key modifiers (which are still available if you use them).
    • Also if the authors field is empty for a reference, we now try to use editor names instead in the Alfred results list.
  • 1.2.88 years ago, 1.0 MBDownload

    1.2.8 β€” add phrase search, so for example 'cartesian theatre' 2016 will find papers that use that exact phrase rather than before where cartesian and theatre were searched irrespective of their location. Fixed a couple more bugs.

    screen shot 2018-07-21 at 20 47 08

  • 1.2.78 years ago, 1.0 MBDownload

    Small bug fix to deal with the author parsing if the author field is empty.

  • 1.2.68 years ago, 1.0 MBDownload

    A typo broke betitle and beall from searching. Fixed here...

  • 1.2.5a8 years ago, 1.0 MBDownload
    • In the results list for becite/betitle/beall, the first AND last author names (with initials) are now shown.

    becite

    • If a becite/betitle/beall results list item has an attachment, you can Quicklook it directly from Alfred without losing focus β€” just press shift or ⌘Y!
  • 1.2.48 years ago, 1.0 MBDownload

    becite / betitle / beall now shows if a reference has an attachment in the results list, and for Bookends 13.x users we use the new applescript JSON events that are somewhat more efficient.

    becite

  • 1.2.38 years ago, 1.0 MBDownload

    When you use becite / betitle / beall, you can now use [fn] + select to open the reference and its attachment (usually a PDF) directly.

  • 1.2.28 years ago, 1.0 MBDownload

    There were a couple of small changes to the Scopus API, which have now been integrated.

  • 1.2.18 years ago, 1.0 MBDownload
    • Rewrote the becite, bebib and betitle tools to perform a mutliple item search (i.e author1 + author2) and you can add an optional YEAR to refine the search. So for example [Zipser Lamme 1998] searches for references by authors (or editors) Zipser and Lamme published in 1998.
    • Also optimised the search code (rewritten in Ruby) so now it takes much less time for large results sets.
    • Because it is so much faster, add a new [beall] tool like betitle but to search in all fields.
    • For becite/betitle/beall you can now use SHIFT to open ref directly in Bookends.