Example of making Zotero work with Hook

Hi @LucB, no, nothing in that link applies.

I wonder whether I am using Hook correctly? I can link to a Word document in Finder but when the same document is open (and Word is the top screen and no other palette is open) Hook says there is ‘no linkable item’. Is this right?

I save all my files locally but they are synced with OneDrive. Could this be causing the issue? I have made sure that any Word doc has finished saving when attempting to Hook with it.

Hi Aaron, as noted on the Linkable Mac Apps – Hook page:

Integration with Microsoft Office requires Office 2016 or Office 365. Hook is not necessarily qualified for Microsoft “Insider Fast Builds”, which are pre-general release builds. Microsoft says those builds are “Best for Insiders who […] don’t mind the bit of risk involved in using unsupported builds.”

Are you using MS Office 2011? That wouldn’t work.

I’m using Microsoft Word for Mac v 16.40 on my work iMac and v 16.41 on my home Macbook.

This is O365, as per https://docs.microsoft.com/en-us/officeupdates/update-history-office-for-mac, which was updated August 2020.

I’m using v 5.0.90 of Zotero.

Hi Aaron, we’ve not encountered issues as widespread as you are reporting. I wonder if there’s something wrong in system libraries. I recommend that you try Hook in a different macOS user account to see if the problems are specific to one account or system wide.

I think I figured out the issue! It appears to be because everything is stored on my OneDrive folder (word docs and Zotero).

When I save a .docx to the documents folder Hook ‘sees’ to the file and I don’t get ‘no linkable item’

I did set up a new user account and the same issue was occurring - that’s what lead me to try saving into my documents folder instead of a file in my OneDrive folder.

I’m surprised this hasn’t come up earlier with so many people now working remotely

Thanks for your persistence, @Aaron , and for sharing it.

And sorry I forgot about OneDrive. OneDrive compatibility was discussed earlier on the forum, where I wrote

That was based on my test at the time. Does that work for you?

The Linkable Mac Apps page linked / links to that issue. I’ve tweaked the text to include the specific quote above.

Stevelw reported there Hook works with OneDrive under some conditions.

Perhaps best to continue the OneDrive issue discussion in that topic, since this one’s title is about Hook.

Hi Team Hook and Users! Newbie user of Hook here struggling to make Hook work with Zotero. Like the OP I constantly get the “No linkable item found in Zotero” message.
Hook works nicely with Devon, Typora, Nvalt etc. but no joy with Zotero. Have given all the permissions to Hook in macOS (10.15.6) and using the lastest version of Zotero (5.0.91beta3). I ran through the items on “No Linkable item”-help page and none of them seem to apply. My Zotero storage is on the local hard drive. I’ve switched Zotero’s language setting to English to no avail. I’m wondering whether I need to do something specific to the zotxt add-on in Zotero? I’m a huge user of Zotero and getting Hook to work with it would make all the difference. Thanks –

Sorry, meant not the OP but user Aaron.

I contributed an early version of the script that adds Zotero support. I’ve just switched to a new machine, and it’s stopped working for me too. This script below is currently working for me (it’s a merge of my original way of doing things with improved code added before the release). Let me know if this fixes things for you.

use scripting additions
use framework "Foundation"

set zotext_result to do shell script "curl -s -d selected=t\\&format=json  -G http://127.0.0.1:23119/zotxt/items"
set str to current application's NSString's stringWithString:zotext_result
set theData to str's dataUsingEncoding:(current application's NSUTF8StringEncoding)

set {res, theErr} to current application's NSJSONSerialization's JSONObjectWithData:theData options:0 |error|:(reference)

if res is missing value then error (theErr's localizedDescription() as text) number -10000
set aList to res as list
set theName to title of item 1 of aList

set zotext_result to do shell script "curl -s -d selected=t\\&format=key  -G http://127.0.0.1:23119/zotxt/items"
set str to current application's NSString's stringWithString:zotext_result
set theData to str's dataUsingEncoding:(current application's NSUTF8StringEncoding)

set {res, theErr} to current application's NSJSONSerialization's JSONObjectWithData:theData options:0 |error|:(reference)

if res is missing value then error (theErr's localizedDescription() as text) number -10000
set aList to res as list
set theLink to item 1 of aList

set theLink to "[" & theName & "](zotero://select/items/" & theLink & ")"

return theLink

Welcome to the Hook Productivity Forum , @kithairon, and thanks for letting us know about your experience with Zotero.

I have added a note to the Zotero entry on the Linkable Mac Apps – Hook page, linking to this forum topic.

Thanks for this, @brock! I haven’t studied the script yet. But we will study it, give it a whirl too, and update the Integration server if it works out.

Thanks for the help @brock and the welcome @LucB. Have tried out the script but still no success. Could I have missed something in the set-up of zotxt?

1 Like

Have found the solution: after installing the vanilla version of Zotero (rather than the beta) the script provided from Hook (v133) does the job – Zotero and Hook work together beautifully. I’ve also tried @brock’s version; this one didn’t work for me and gave me the “no linkable item” message. Grateful for your help though and for the forum here! Happy new Pro User.

1 Like

That’s interesting @kithairon - perhaps there is something odd about my setup rather than yours? I’m using Zotero v5.0.90 and have Better BibTex 5.2.68, ZotFile 5.0.16, and zotxt 5.1.0 installed. Are those similar to what you have now?

1 Like

Similar setup here: Zot 5.0.90, Zotfile 5.0.16, Zutilo 2.0.4., ZoteroQuicklook 1.4.2, zotxt 5.1.0, LibreOffice Integration 5.023.SA – BibTex and ODF-Scan are disabled since currently not in use.

1 Like

Thanks @kithairon - it looks like a difference in preferences and configuration rather than versions then.

OK, so if I ask zotxt for the currently selected item, I get something like this:

msslmaj:~ djb$ curl -s -d selected=t&format=json -G http://127.0.0.1:23119/zotxt/items
[
{“id”:“shenNewRetrackingAlgorithm2019”,“abstract”:"A new method

with much text removed from the end. That ID item at the start is what the official script extracts to put onto the select URL that tells Zotero to select something. However, my understanding is that Zotero needs a KEY in that link, something formatted like ‘1_K6UIKXJI’. My script runs a second query to get that.

So if you run that command in the terminal, do you get a cite key in that id field like me, or do you get a key that can be used in a select link?

I’ve tried constructing a select link with the cite key and it doesn’t work (for me). I’m wondering if I’ve set something up so that what comes out in that id field is different for me compared to others.

When you create a working markdown Hook link, does it look like this?:

A New Retracking Technique for Brown Peaky Altimetric Waveforms](zotero://select/items/1_K6UIKXJI)

1 Like

@brock: Sorry for the delay - had an offline stint.
When I create a markdown link with Hook for my Zotero entry of
Merleau-Ponty, M. (1945): Phénoménologie de la perception. Gallimard.
I get the following output
Phénoménologie de la perception. Pasted into nvalt – after shutting down Zotero – the link correctly starts up Zotero and highlights the correct entry in my Zot-library. So, long way to answer affirmatively to your last question.

I didn’t get the first part of your post though, never having worked with zotxt or emacs. When you say:

Blockquote OK, so if I ask zotxt for the currently selected item, I get something like this…

What do you actually do? (Sorry simple user, no coder)
Hope this is answering your question at least in parts.

@kithairon Zotext creates a web server running on your machine than can answer queries. The use of the command ‘curl’ in my post asks that webserver to send you information about what is currently selected. If you want to try it, run the terminal app and paste everything from ‘curl’ to the end of ‘items’ into the window and hit return. Don’t worry if you don’t feel comfortable doing that though - I can keep debugging the issue.

1 Like

Thanks for explaining.
I realize that the markdown link I wanted to show you actually turned into a real link here in the forum.

Blockquote

[Phénoménologie de la perception](zotero://select/library/items/HAAEINBT)

Using the following command in terminal
curl -s -d selected=t&format=json -G http://127.0.0.1:23119/zotxt/items I get:
[2] 19367
-bash: -G: command not found
[1] Exit 2 curl -s -d selected=t
AMW-5:~ amw$ curl: no URL specified!
Hope some of this helps!

Hi - I have Hook working with quite a few apps but not Zotero. I installed the Zotxt extension. I still get a “No linkable item” error when trying to link from a Zotero item.

Interestingly Zotero is not among the apps listed in System Preferences for Hook automation. Might that be the issue? How can I add this?

image

@rkaplan: Not sure what could solve your issue. But I note that while Hook and Zotero work well with each other in my setup I also don’t have a Zotero entry in the SysPrefs for Hook automation. I thus suspect this is not the reason for what’s not working in your case.