Jump to content

ZotQuery: an Alfred workflow for Zotero


Recommended Posts

5 hours ago, Damoeire said:

Mine was a stand-alone note, created by Zotero-File-New Note

 

Right. No, they're not supported because:

 

5 hours ago, Damoeire said:

they can't be cited

 

Apart from not really fitting the data model (no author etc.), I figured the whole point of the workflow is to quickly copy citations.

 

5 hours ago, Damoeire said:

but it's just taken from the first line of the note.

 

This is correct.

Link to comment

@deanishe: enormous thanks, the more recent updates to the workflow resolved my earlier issues. You are a star. I am thrilled to have this workflow.

 

One feature request: could the workflow be used to export bibtex? No big deal if this is difficult, as doing so currently only requires me to use the workflow to navigate to Zotero, and then to quick-copy using a shortcut. 

Link to comment

Just uploaded v0.1.4-beta.

  • Add resolution of dependent styles
  • Add support for different locales
  • Force full re-indexing of Zotero entries when the db changes
  • Copy citation-style and bibliography-style citations for one style
  • Generate citations with Ruby instead (citeproc-py is buggy as hell)
  • Add action to open logfile

 

I think I'm pretty close to a v1 release now.

Link to comment

Just tried 0.1.5 from GitHub with a few different CSLs and Zotero entries and have no problems to report.

 

I installed the BibTeX CSL mentioned above and it works, too. 

 

Ruby citeproc is a little slow.  But certainly useable.

 

Seems ready to release from what I can tell.

Link to comment
59 minutes ago, dfay said:

Ruby citeproc is a little slow.

 

Isn't it? But citeproc-py was choking left, right and centre. It had to go in the bin. I'll look for a faster solution, but at least it's working fairly reliably.


One thing I'd like in order to do some more thorough testing is more "exotic" citation styles with stuff like bold, super-/subscript, underline etc.


citeproc-ruby's formatting support seems rather more limited than py's, and my custom HTML-to-RTF converter needs more testing.

Link to comment

I've been on Christmas break, and have been away from the computer for the most part. I did notice today that when I chose zotconf it told me that the workflow was up to date even though I didn't have the latest one. I don't know if that's an issue for you, but the update worked flawlessly. I'll keep testing it.

Link to comment

Now the work has started again its great to have this workflow. A reminder to myself and anyone else that uses ZotHero to buy @deanishe a beer or two. I'm doing that now.

 

Personally, I would find being able to use first name in the author search useful as well. I know its common practice to refer to authors by their last name, but sometimes, the brain just doesn't work that way and all you can think of is the first name. 

Link to comment
11 minutes ago, Damoeire said:

I'm doing that now.

 

Thanks very much!

 

12 minutes ago, Damoeire said:

I would find being able to use first name in the author search useful as well

 

Easy enough to do if it isn't going to mess up search results too much.

 

Link to comment
3 minutes ago, deanishe said:

Easy enough to do if it isn't going to mess up search results too much.

 

I can't see how it would. Unless your searching for a very short last name, like 'Oh'. I suppose then it could annoy someone.

Benefits outweigh the negative in my opinion, but we could wait and see if others have an opinion.

 

6 minutes ago, deanishe said:

Thanks very much!

 

Thank you very much! It was a very small price to pay, two beers. I hope other users do the same, it was great work that you had little or no reason to do!

Link to comment

Hey everyone,

 

Thank you SO much for the work being done to redo this workflow for Alfred 3.  I use a Zotero plugin called Better Bibtex ( https://github.com/retorquere/zotero-better-bibtex ) in order to use Zotero to generate .bib files to work with LaTeX.  This plugin creates a Citation Key in the info pane:

5a4fcf3512bdd_ScreenShot2018-01-05at11_16_48AM.png.3b4053523cebe3dba1b9816bab827d6e.png

that is then referred to in a LaTex file (ie, \cite{berkowitz_exchange_1999} ).  I was wondering if it is possible to add the ability to copy this citation key into ZotHero - I have minimal experience coding so I'm unsure if this is at all feasible, or simple.  

 

P.S., How many euros is a beer? I've never had the pleasure to visit Europe.

Edited by Basket
Link to comment
1 hour ago, Basket said:

I was wondering if it is possible to add the ability to copy this citation key into ZotHero

 

See @dfay's post further up the page.

 

I think that's what you're looking for?

 

EDIT: You might be better off with the CSL style from the plugin. As best as I can tell, it works with standard Zotero data, not anything plugin-specific.

 

In any case, the workflow can't access the plugin's data. It only reads Zotero's database and styles directory. The plugin's data appears to only exist within the running app, so the workflow can't get at it.

 

1 hour ago, Basket said:

How many euros is a beer?

 

About €4 for a man-sized one. Less for the funny little ones the Germans drink.

Edited by deanishe
Link to comment

Alfred will remember the query as long as you're using the zot keyword. If you're using zot: to select a field to search, Alfred won't because it doesn't remember queries entered in External Trigger mode (when the workflow's logo is show on the right of the query box).

 

FWIW, when you choose a field from zot:, all the workflow does is call the normal zot search with title: or tags: as the query.

Link to comment
11 hours ago, Damoeire said:

Would you mind me letting people know about this workflow on other sites

 

Not at all. I should probably give the workflow its own thread on the forum first though. And yeah, GitHub would be the right place to point them to.

Edited by deanishe
Link to comment

This seems awesome, but I can't get it to work. For any keyword (also 'zotconf') I get the error “'NoneType' object has no attribute 'name'”. I'm using Alfred 3.2.1 on macOS 10.12.6. I paste the debug log below. Any ideas?

 

 

Starting debug for 'ZotHero'

[2018-01-16 00:46:00][STDERR: input.scriptfilter] .
00:46:00 workflow.py:2055 DEBUG    ---------- ZotHero (0.2.0-beta) ----------
00:46:00 workflow.py:1462 DEBUG    reading settings from /Users/xxxxx/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred.zothero/settings.json
00:46:00 workflow.py:2339 DEBUG    update check not due
00:46:00 zh:580 DEBUG    args={'--bibliography': False,
 '--help': False,
 '--style': None,
 '--text': None,
 '--title': None,
 '<id>': None,
 '<query>': u'',
 '<style>': None,
 'attachments': False,
 'citations': False,
 'clear': False,
 'config': True,
 'copy': False,
 'fields': False,
 'locale': False,
 'notify': False,
 'reindex': False,
 'search': False,
 'select': False}
00:46:00 core.py:49 DEBUG    [core] cachedir=u'~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred.zothero'
00:46:00 core.py:50 DEBUG    [core] zotero_dir=u'~/Work/References/Zotero'
00:46:00 core.py:51 DEBUG    [core] attachments_dir=None
00:46:00 core.py:109 DEBUG    [core] storage=u'~/Work/References/Zotero/storage'
00:46:00 core.py:110 DEBUG    [core] styles=u'~/Work/References/Zotero/styles'
00:46:00 cache.py:300 DEBUG    [cache] opening store 'styles'...
00:46:00 cache.py:300 DEBUG    [cache] opening store 'modtimes'...
00:46:00 workflow.py:2074 ERROR    'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "./lib/workflow/workflow.py", line 2067, in run
    func(self)
  File "./zh", line 610, in main
    return do_config(args['<query>'])
  File "./zh", line 332, in do_config
    log.debug(u'Default style: %s', style.name)
AttributeError: 'NoneType' object has no attribute 'name'
00:46:00 workflow.py:2076 INFO     for assistance, see: https://github.com/deanishe/zothero/issues
00:46:00 workflow.py:2097 DEBUG    ---------- finished in 0.070s ----------

 

Edited by cands
Link to comment

It sounds like you have an invalid style set. Did you delete the style from Zotero?


Open the workflow variables sheet in Alfred Preferences and make sure the CITE_STYLE variable is empty, then try again.

 

I've added some code to catch this error, which will be in the next release.

Link to comment

You're right (as usual), thanks! I had written "IEEE" in the Workflow Environment Variable CITE_STYLE. That is a valid style. However, after removing it the workflow is working again. When using the built-in function to set the cite style I can now use IEEE, and I see that CITE_STYLE has been set to "http://www.zotero.org/styles/ieee" (I now see in the manual that you recommend to adjust the CITE_STYLE or LOCALE variables by using the zotconf keyword).

 

Wow this workflow is super handy, thank you very much!

Link to comment

It’s a bug in any case. It shouldn’t die without letting you fix a bad setting. Also, even if CITE_STYLE were valid, deleting the style from Zotero would cause the same error.

 

So thanks for finding the bug.

 

4 hours ago, cands said:

you recommend to adjust the CITE_STYLE or LOCALE variables by using the zotconf keyword

 

Yeah. UsIng the URL as an identifier is much safer, as it’s basically guaranteed to be unique.

 

Perhaps I need to edit the README to emphasise how bad an idea setting the variables by hand is.

 

I suppose requiring users to change some settings by hand but avoid editing others isn’t the best approach.

 

I should probably also make sure it doesn’t choke on an invalid LOCALE…

Link to comment

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...