Jump to content

Bookends search and citations


Recommended Posts

Bookends Search is designed to search your Bookends Library for an author and paste either a citation or a formatted reference. The authors name must be correctly capitalised.
 
There are three options for citations
1. Bookends citation (default) - {Author Year UUID}
2. Multimarkdown citation (⌘) - [#BibTexKey]
3. Pandoc citation (⌥) - @BibTexKey
 
For the latter two options to work you need to ensure that BibTex is turned on in preferences in Bookends and that each reference has a BibTexKey
 
There are two options for formatted references
1. Reference formatted according to selected reference style in Bookends
2. Multimarkdown formatted reference (⌘) - [#BibTexKey]: Reference

 

Bookends%20search%20screenshot.png

 

Can download the workflow here

 

Changes:

20160510 - update to paste citation automatically

20160524 - update to allow search for diacritic letters and speed up script processing

20160615 - update to change XML encoding

Edited by kseggleton
Link to post

Many thanks for working on this. Awesome! I would have needed it a while ago when working on my PhD :-) Never mind, this is very much appreciated. though, I am struggling a little bit with the workflow as the search of my database seems to be nor working perfectly. I can't find the entrance I am looking for. 

 

An additional feature, and I am not sure whether this is actually possible, would be to insert the citation automatically in the text editor (I am using Scrivener and when pressing Cmd+y in Bookends, the citation is automatically inputted into Scrivener). 

 

Cheers!

Link to post

I can second Easytiger's comment (both in terms of thanks and in terms of troubleshooting!). If I type out one letter, the workflow seems to work, and to show a list of entries. If I type two or more letters, all entries disappear. Here's the debug list:

Starting debug for 'Bookends Search'

[ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)'. Row (null), Col (null): 'Extra content at the end of the document' in XML:
<?xml version="1.0"?>
<items>

<!-- Note: I omitted the list of entries listed in the debug section -->

[ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)'. Row (null), Col (null): 'Extra content at the end of the document' in XML:
<?xml version="1.0"?>
<items>

I hope that helps!

Link to post

"Good" to hear that it is not just me having these problems. The output seems pretty strange as calebaharrison has mentioned. I also have this issues if I type two letters, I get one or two names. If I type the correct name, I get no results. 

 

I really hope you can fix this as this is certainly the workflow that would make things complete in terms of producing academic output :-)

Link to post

Sorry that there are problems. I will try and look at what the issue is - at this stage I am not sure as the script works fine for me. The only time I can replicate this is when the name of the author does not match the spelling of the author in Bookends. In the error log that you get you will see a list of author names and article names that the workflow matches, as you progressively type a name the filter will start excluding names (that do not match the spelling in Alfred) and the script will stop working when there are no names to match thereby triggering the error message in the log. Could you tell me whether the spelling is absolutely identical between what you type in Bookends and Alfred? The script will pick up any author name, whether it is a first, second or subsequent author. Also do you have multiple Bookends libraries or just one? 

Edited by kseggleton
Link to post

Hi, 

 

I tried it again, here is my debug list. I deleted the whole number of entries, but there seems to be an error at the beginning. I have no idea what the problem is, maybe some issue with my bookends database?! I only have one or at least I have one opened in bookends. 

 

I won't get any results if I type a correct author's name. Sometimes, if I type two letters I get an output. 

 

I really hope this problem can be solved. Very much appreciate your effort. 

 

Thanks

 

P.S. Just looking at it again, it is strange as the author seems to be the "title" here, whereas the original title is the "subtitle". This is really strange given that the entries in bookends are made in the correct fields. 

 

P.P.S. It seems that shortly after I typed in an authors name that a list pops up for less than a second, but disappears immediately and only the query is shown without any results. 

Starting debug for 'Bookends Search'

[2016-05-10 08:41:04][ERROR: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 68.)'. Row (null), Col (null): 'xmlParseEntityRef: no name' in XML:
<?xml version="1.0"?>
<items>

<item uid="388" arg="388" valid="yes">
<title>Ukeje 2008</title>
<subtitle>Globalization and Conflict Management: Reflections on the Security Challenges Facing West Africa</subtitle>
<icon>file.png</icon>
</item>

<item uid="54972" arg="54972" valid="yes">
<title>Vreÿ 2013</title>
<subtitle>Turning the Tide: Revisiting African Maritime Security</subtitle>
<icon>file.png</icon>
</item>
[2016-05-10 08:41:04][ERROR: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)'. Row (null), Col (null): 'Extra content at the end of the document' in XML:
<?xml version="1.0"?>
<items>
Edited by Easytiger
Link to post

I don't think that the Applescript likes the - ÿ character. If I just type 'Vre' I get your entry, but if I type 'Vreÿ' I will get the error message. I don't know whether there is a workaround to this - I will have a look when I get some spare time. Ignore the <title> - <subtitle> comments in the log output - they indicate the title and subtitle of the XML fields that are outputted in Alfred and correspond to the author and the title in Bookends respectively.

Link to post

I actually haven't tried it with the special characters. I have over 1000 entries in my bookends database, including my own publications. Having a rather simple surname it still doesn't work with any of the entries. 

 

I would very much appreciate if you could have a second look when you have spare time. thanks a lot for your effort. 

 

Edit: I found the problem. The workflow is very strict on upper and lower cases. Thus, if I use a capital letter for the authors it worked. Maybe you could modify the script in a way that upper and lower case do not have any influence on the script. 

 

Cheers 

Edited by Easytiger
Link to post

Thanks kseggleton! 

 

Just for future additions: It would be great to not just copy the citation but also be able to automatically insert the citation into a other program (like Word or Scrivener). Not sure whether this is actually possible, though if you are planning to play around with your workflow in the future, this is certainly something with would be a great addition. 

 

Cheers!

 

Edit: Sorry, it is me again :-) I discovered a different problem. If I have an entry in Bookends that includes more than just one author the citation is only outputted with one author listed and not two or more of them. Maybe you can check on this. 

Edited by Easytiger
Link to post

Have made a change to automatically paste the citation after selecting it.

 

 

 

If I have an entry in Bookends that includes more than just one author the citation is only outputted with one author listed and not two or more of them

 

This is the default setting. It doesn't matter that only one author is outputted as Bookends will pick up the correct reference when you scan your document based on the UUID (the number at the end of the citation in the curly brackets)

Link to post
  • 2 weeks later...

Have just updated the script to allow for searching for diacritic letters (thanks to help from the Bookends script forum). Also made change to speed up processing for large databases (set script behaviour to automatic delay after last character typed)

Link to post
  • 3 weeks later...

I don't think that the Applescript likes the - ÿ character.

It's probably not AppleScript. Most likely, it's because the XML is invalid. You can't include non-ASCII characters in XML unless you also specify the correct, non-ASCII encoding.

Try starting the XML with <?xml version="1.0" encoding="utf-8"?> instead of just <?xml version="1.0"?>

Link to post
  • 1 month later...

Has the workflow been working for people, still? I'm still hit-or-miss on it, though largely 'hit' since updating. For instance, with a reference with the last name "Ãhman": "Ã" will find it, but "Ãh" will encounter the XML error noted earlier. Not a huge deal, but curious if any changes have been made. Thanks for the work, kseggleton!

Link to post
  • 10 months later...

A little late to the thread...

It wasn't working for me neither if I didn't capitalize the first letter. Is there anyway to change the script to allow the input in any form? small or all caps? I am not savy with apple script. =P 

workflow.gif

Link to post

I feel you. I am also doing my PhD. I have been experimenting with my workflow. My group uses Zotero and I was trying to make Papers work, while also being able to do citations in Pandoc with BibDesk. Unfortunately, after some meddling, I accidentally Papers deleted my pdfs! So now I am experimenting with Bookends

Link to post
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...