Hook To New > Obsidian

How to set Hook to New in Hook 3.7 and Obsidian 0.15.5?
Currently I have

And the new note (with link to item) is created int the root of the vault instead of the specified folder
(but maybe I misunderstood something)

We pulled 3.7 public beta 1, but I assume you are using macOS 12 on which it is OK to use Hook 3.7.

For obsidian, please see Using Hook with Obsidian – Hook. If you overrode the Obsidian script in Scripts Tab – Hook you may need to remove your override (with the “-” button on bottom left of Scripts pane).

1 Like

It’s been a long while… Nice to see it is working.

Question: Are (and if so, how are) templates supposed to work?

I’d like to tell hookmark which Obsidian folder to put the new note into, and ideally also immediately choose some template along with it (e.g., to put a timestamp).

I’ve manually done it by hacking the current new script - see

http://www.mnott.de/hook-to-new-obsidian-note/

but I think I just don’t understand how templates are supposed to work.

Thanks!

Welcome back, @eMaX . The Hook to New templates currently only support Finder-based apps: Templates – Hookmark.

Each app can have a “new item” script, but it depends on the scripting capability of the integrated app.

Thank you Luc!

I don’t really understand what really a “Finder-based” app is. Could you give actual examples / walkthroughs about this? I was trying to understand from the documentation, but somehow it evades me.

Maybe I need to hookmark my Coffee machine :smiley:
M

1 Like

Sorry my answer was not super helpful. Let’s try again.

First you can use Hook to New with Obsidian out of the box.

The subtlety pertains to templates if you want to use them: Hookmark’s templates work best with apps that create files that they can open when users double-click on the file in the Finder. Those are apps where Finder, > Get Info > “open with” works well.

The Obsidian case is subtle because it is an electron app which does not act like a regular mac app in some ways. You can’t just double click on the file in Finder and open the file in Obsidian. That means you can’t easily make it a default template. If you try in Finder, macOS will say something like:

“Obsidian2.md” is damaged and can’t be opened. You should move it to the Trash.

So the work-around is

In Finder:

  1. create a template file
  2. and make a macOS friendly app the default

In Hookmark > Preferences > Notes,

  1. Choose an obsidian vault as folder
  2. Make a proper Mac app the default app. (Not an electron app)

Notice I used a file called text.md as the template file. (I had edited this template file to have the content I wanted). BBEdit is the default for “md” files on my system. I can’t make it Obsidian due to Obsidian being electron (and the Electron folks choosing not to fully integrate with macOS).

Terminal defaults

defaults write com.cogsciapps.hook integration.obsidian.URL.scheme hook-file

this will setup hooks between the file and whatever was the context of the Hook to New command.

Run time

do: Hook to New > that default (text.md)

Thereafter, you can invoke Hookmark on the file in Obsidian and you’ll see the hooks . And vice versa.

better

if you can find a way to make Obsidian open apps from finder, it will be easier. Someone on the forum have found a solution. I can’t recall. The Obsidian forum might know.

even better

Hookmark’s “New Item” software integration framework is quite powerful. There’s probably a way we could use or extend it to integrate with Obsidian’s electron-like way of opening files. That would require an Obsidian API ( x-callback-url and /or plugin).

Is it possible to modify the script so that instead of creating a new note in Obsidian, it appends to a specific note? The best would be some kind of note picker (starred files or something similar) to choose which note the link should be appended to. The Advanced-URI-plugin has a command for this.

Another option is to append the link to the daily note. There is also a advanced-uri link that appends to the daily note, so it should be possible.

The Obsidian Hook to New script is exposed in Hookmark’s Script Editor pane. Users can create Hook to New variants from there. If no one responds here, you could try the Obsidian forum. Lots of Hookmark users there too. In fact one of the plugins developed for Hookmark: https://hookproductivity.com/help/integration/using-hook-with-obsidian/ was not even a Mac user yet; he is currently using Linux.

1 Like