html Link to Open Zotero (and a specific document)

Hello,

I'd like to write summary notes that link to the files that they will be summarizing. What I'd love is a way to to have these links open Zotero and select the desired file. Of course it would then be only compatible with my own zotero account and would assume that that's installed, but that's no problem.

The closest I've found is an organization structure that seems to apply only to web snapshots of the format zotero://attachment/#/. A href to these files will open the web snapshot in the browser, which is close to what I'm after. But if the link could highlight that file within zotero, I'd be in heaven.

I guess the next best option will be to link to the corresponding Library file at https://www.zotero.org/sackvillian/items/##### but again it's not quite what I'm after.

Any help would be greatly appreciated!
  • Perfect, thanks.
  • The zotero://select command is definitely what I'm after but I haven't been able to find the requisite library key hashes.

    Dan suggested that they are given in reports generated on individual items but that doesn't seem to be the case. Is the problem that I'm running 2.0.9.r7437? Does this build even support using library key hashes with the select command?
  • The local library can be referred to with key 0.
  • Sorry, let me rephrase.

    How can I access any of the document identifiers compatible with the zotero://select command from within the GUI? Is there a way to have reports contain such information?
  • The reports contain them, but only in the URL:
    zotero://report/items/0_EZXVJ5ZW/html/report.html

    0_EZXVJ5ZW is a key for an item in my library -- zotero://select/0_EZXVJ5ZW will select it

    I made an export translator for this once -- https://github.com/ajlyon/zotero-bits/raw/master/zotselect-link.js

    Save it to the translators directory of your Zotero data directory, restart Firefox, and ZotSelect Link will appear as an option when you elect to export items. The translator generates links of the form zotero://select for the selected items.
  • Thanks for the responses.

    I've tried the zotero://select/ with the key obtained from the address of a report but Zotero cannot locate the items, producing this error in the debug log:

    (3)(+0000000): No arguments provided to Items.get()

    (2)(+0000000): Item not found in zotero://select

    Does it matter that I'm using 2.0.9.r7437?
  • Ahhh if I use zotero://report/items/$LibraryId this works like a charm! This change might be a quirk of Macs or my version but either way, I'm very glad it's working.

    But one last question, presumably aimed at you ajlyon, and I'll stop pestering.

    Is there a similar identifier that will be consistent among several computers on the same account that I can access via the GUI? Library-key hashes seem like a likely suspect but I have no idea of how to get 'em.

    Many thanks.
  • Use the ZotSelect Link translator that I posted, or look at its code.
  • A simple, but very partial, solution is: Create a Report from the item you want; copy the URL of that report; then use that URL as a hyperlink in the program that you want to link from (e.g., Word). When you click on that hyperlink, the report is created anew and pops up very nicely. So at least you can see the information from the item, even if you are not brought to the item itself.

    It is possible, using a similar logic, to create a hyperlink to the item itself -- but that has two problems: 1) it takes a few steps to convert the "report" hyperlink to a "select/item" hyperlink; 2) the link doesn't necessarily work well, depending on whether Zotero is in tab mode or pane mode, and (it seems) whether it's in a good mood or not.
  • edited September 5, 2011
    ajlyon that link to the translator no longer works. Is the file still available somewhere?

    edit: I managed to find the file in your github history (here in case anyone wants it). However, when I install and try to use it, it doesn't work. Nothing happens when I drag and drop to export with that translator set as the default, and if I right-click export it gives the error: "An error occurred while trying to export the selected file". Can you suggest what I might be doing wrong?
  • A fixed version of the translator that works for me: https://gist.github.com/3134386
  • Nathan - there is a small bug in your translator.
    https://gist.github.com/nschneid/3134386#file-zotselect-link-js-L19
    and
    https://gist.github.com/nschneid/3134386#file-zotselect-link_simple-js-L19
    should be
    var library_id = item.libraryID ? item.libraryID : 0;
    i.e. the libraryID variable starts with a lowercase letter. This only matters for groups. It seems silly to make a separate copy of this just for that, so if you'd fix it?
  • @adamsmith: Fixed it. Thanks!
Sign In or Register to comment.