Create Skim/Hook Compatible Deep Links Using X & Y Coordinates + Standard Filepath

I’ve been using Obsidian along with a few Zotero-related plugins extensively.

One of these plugins extracts all highlights and comments from a designated PDF stored in Zotero to a new note in Obsidian. One of the templating options is for the extracted highlights to include a link to the source PDF.

By default, these are links merely to the PDF file. But I would prefer that they instead be deep links to the specific extracted highlight.

The Obsidian plugin on which I am relying to extract annotations can pull up an X coordinate, Y coordinate, page number, and conventional file path for the target PDF. And you can include whatever fixed portions of a URL you wish around this variables—e.g. hook:///file/[x coordinate].pdf or something like that (this is merely an example of how fixed elements and variables can be combined, not my idea of a URL that should actually function).

Is there a way I could use these template variables to generate Hook/Skim compatible deep links, even if those links are somewhat less robust than the more persistent filepaths generated by hook?

For reference, here are the variables I can use to generate URL’s from the relevant Obsidian Plugin—

  • {{annot.page}} - This pulls the page number of the designated annotation
  • {{annot.x}} - This pulls an x coordinate for the designated annotation
  • {{annot.y}} - This pulls a y coordinate for the designated annotation
  • {{annot.attachment.path}} - This pulls the standard file:/// path for the underlying PDF. You can also use replace functions to URL encode this if needed.

Any ideas on how I might use these variables to auto-generate Hook- & Skim-compatible deep links? For reference, it would be perfectly adequate for me for the auto-generated link to merely open to the correct page of the PDF.

The difficulty I’m having is that the links must be generated without Hook (because I’m relying on the templated export options with the relevant Obsidian/Zotero plugin), yet must be openable by Hook & Skim.

Hi @julroger2013, are you still working on this modification of the Obsidian plugin? I have a similar workflow and would be very interested in how you solved this problem!

If you’re still wondering how to retrieve a hook link without interacting with the app, you may be interested in the applescript that hook provides for alfred, which I found easily adaptable for other use cases. Also, Brett Terpsta has written a command-line script to retrieve hook links, but it seems to work quite slowly.

1 Like

There are also Shortcuts.

For instance, there are 3 Shortcuts you can add to Finder:

  • Hook Selected Files Together
  • Hook to Copied Links
  • Mesh Link

then, select files in Finder to use those commands directly. there was a screenshot in recent newsletter.

1666671743