Devonthink - Create New Markdown Note With YAML Meta Header

Hi All,

I'm trying to replicate this KM Macro kindly provided over on the Zettelkasten Forum.

I'm attempting to achieve the same results, but within Devonthink.

The Outcome I'm trying to replicate:

  • A macro is triggered with a keyboard shortcut, and a new markdown note is created in Devonthink
  • The new markdown note automatically populates and prepends the meta information required.

The Result (Using The Archive and KM):

Create Note with Header.kmmacros (5.2 KB) YAML.kmmacros (2.0 KB)

I'd be very grateful for any help with this, as my attempts so far have not worked.

Appreciate your time and input in advance! :grinning:

This can be accomplished relatively simply with DEVONthink's URL scheme and KM's URL Percent Encode Filter and Open URL actions:

Create Devonthink Note with Header.kmmacros (5.3 KB)

2 Likes

@gglick, that's wonderful! Thank you for your help! One small request, is there a way I can set the title of the markdown note created to either just the variable: %Variable%zettelUID% or %Variable%zettelUID% - any name here?

Because I use the Zettelkasten method, all my notes are named as follows:

202007031609 - any name here

Your thoughts would be appreciated. Thank you :grinning:

One small request, is there a way I can set the title of the markdown note created to either just the variable: %Variable%zettelUID% or %Variable%zettelUID% - any name here?

@gglick, it's ugly... But I got it to work :crazy_face:

Create Devonthink Note with Header (Title Case).kmmacros (6.4 KB)

Looks good to me. Nice job! My only real suggestion would be to remove these Filter actions, since they don't serve any purpose (because the title and UID are already being percent encoded in the LocalText and FileNameDashed variables):

@gglick, thank you :grin: don't quite know what it is I exactly did, just tried to replicate and adapt what I saw in the macro without knowing really what things do... only way to learn eh? :stuck_out_tongue_winking_eye:

I've deleted the redundant filter variables now. Thank you again for all your help!

1 Like

@gglick, one more question, if you don't mind.

I'm trying to add to the macro to open the newly created note in a new window, so once the macro is triggered I can get to writing immediately.

I've tried to open the file with the 'Select' function, but it only opens the previously selected note in DEVONthink.

Is there a way to 'hard-wire' this macro by, maybe fetching the DEVONthink link for the newly created note and opening it in a new window?

Your thoughts would be a great help!

I'm not an expert DEVONthink user, so there may be a better way of accomplishing this, but I was able to get it to open the newly created note in a new window and make it editable with a bit of AppleScript to fetch the new note's UUID:

Create Devonthink Note with Header (Title Case) 1.1.kmmacros (8.1 KB)

I was able to run the macro without pausing, but if you run into any timing issues, try re-enabling the disabled pauses and adjusting their timing.

@gglick, Thank you for your help! Much appreciated!

I have had varying success with this macro. On multiple tests, it would appear it only works fully (i.e. opens the window) if I am within the Global Inbox (the default location it would seem).

I'm now trying to figure out how I can make the macro run and create the markdown note within the Group (Folder) I am currently working in.

Proving to be a bit of a headache... but I'm trying :sweat_smile:

Otherwise, if I'm working from within the Global Inbox, it does exactly as it says on the tin.

Thank you again for all your help!

You're welcome. Once again, this may not be the most efficient way of going about this, but at least in my testing, this worked to make and open a new note in the current group by retrieving the group's UUID and including that as the destination in the note creation URL:

Create Devonthink Note with Header (Title Case) 1.2.kmmacros (8.5 KB)

@gglick, that's exactly it!!! You're an absolute godsend! Thank you so much for all your help with this! My writing workflow has just become a lot more efficient and simpler to accomplish! Thank you! :metal:

1 Like