kseggleton Posted May 7, 2016 Posted May 7, 2016 (edited) 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 citations1. 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 references1. Reference formatted according to selected reference style in Bookends2. Multimarkdown formatted reference (⌘) - [#BibTexKey]: Reference 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 June 15, 2016 by kseggleton Easytiger 1
Easytiger Posted May 9, 2016 Posted May 9, 2016 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!
calebaharrison Posted May 9, 2016 Posted May 9, 2016 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!
Easytiger Posted May 9, 2016 Posted May 9, 2016 "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 :-)
kseggleton Posted May 10, 2016 Author Posted May 10, 2016 (edited) 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 May 10, 2016 by kseggleton
Easytiger Posted May 10, 2016 Posted May 10, 2016 (edited) 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 May 10, 2016 by Easytiger
kseggleton Posted May 10, 2016 Author Posted May 10, 2016 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.
Easytiger Posted May 10, 2016 Posted May 10, 2016 (edited) 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 May 10, 2016 by Easytiger
kseggleton Posted May 10, 2016 Author Posted May 10, 2016 Thanks Easytiger for figuring that out. I will make an edit to my original post to ensure that people in the meantime capitalise the authors name. Will then look at changing the original script Easytiger 1
Easytiger Posted May 10, 2016 Posted May 10, 2016 (edited) 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 May 10, 2016 by Easytiger
kseggleton Posted May 10, 2016 Author Posted May 10, 2016 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)
Easytiger Posted May 10, 2016 Posted May 10, 2016 Perfect! The pasting works fine. Thanks! I understand! Just checked it once you scan the document. You are absolutely right. Cheers!
kseggleton Posted May 24, 2016 Author Posted May 24, 2016 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)
deanishe Posted June 12, 2016 Posted June 12, 2016 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"?>
kseggleton Posted June 15, 2016 Author Posted June 15, 2016 It's probably not AppleScript. Most likely, it's because the XML is invalid Thanks deanishe, changing that line in the XML helped.
calebaharrison Posted August 6, 2016 Posted August 6, 2016 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!
sabgaby Posted June 15, 2017 Posted June 15, 2017 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
kseggleton Posted June 18, 2017 Author Posted June 18, 2017 Hi Sabgaby, I am sorry but I don't have the time to look at changing this at the moment (busy writing my PhD). Will put it on my todo list for the future. sabgaby 1
sabgaby Posted June 20, 2017 Posted June 20, 2017 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
kseggleton Posted June 20, 2017 Author Posted June 20, 2017 If you are using Pandoc you might want to check out this post on the Bookends forum on generating a BibTex bibliography quickly from a static folder in Bookends https://www.sonnysoftware.com/phpBB3/viewtopic.php?f=6&t=4044. I invoke the script with an Alfred workflow.
iandol Posted September 10, 2017 Posted September 10, 2017 Hi, just to say I've modified this to search case insensitive and updated internally to use JSON rather than XML.
kseggleton Posted September 10, 2017 Author Posted September 10, 2017 6 hours ago, iandol said: Hi, just to say I've modified this to search case insensitive and updated internally to use JSON rather than XML. That looks good iandol - I will check it out
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now