Create a Markdown Doc and open it in another application

Hi there!

I’am a new user of DevonThink and would like to realize a macro that creates a markdown note and opens it in Typora. I used Keyboard Maestro and it worked up to the point there the document is created.

But now i cannot figure out how i can open the newly created document in Typora - because i do not know how to fetch the file patch of the recently created MD?

Any help would be greatly appreciated - many greetings


Hi :slight_smile: Before I answer that, what is the intended trigger for the action? Should the markdown note have a specific name?

Hi Blanc!

Thanks for taking your time.

Unfortunately i’am not sure - “Open File” or “Open URL” ?
In both cases i tried inserting the devonthink-Link - but that is not identical to the file path - only a link back into Devonthinks UI.

would this work? set up a keyboard shortcut for “Typora” in system preferences/keyboard/shortcuts/app shortcuts (click +, add a shortcut for DEVONthink, using the exact name of the entry for Typora in the DEVONthink data/open with/ menu. Then trigger that shortcut with KM? Obviously that will only work if the new document is highlighted/selected.

(I don’t use KM and would be doing what you describe with a smart rule & script, I guess; but all roads lead to Rome :))

So that opens the record in DT
From there, I keystroke “o” using {command down, shift down} (Devonthink > Data > Open with)
to open the external app

1 Like

That’s assuming Typora is the associated app; else as described above :slight_smile:

Hi there @all!

Thanks so much for your very helpful insights!!

There is only one hurdle left - the document needs to be selected within devonthink. Currently if i run the script it opens Typora (yay!!!) - but only some randomly selected document. How can i program it so that the newly created markdown is selected, and then opened?

Why does it need to be selected?

If i run the script in the current state it opens a document in the global inbox in Typora
but not the newly created markdown text. So i thought it makes sense to select the newly created markdown and then open it.

@DTLow suggested the above; that should effectively select the record - or does it not?

Hey DTLow and Blanc:

I posted screenshots of my actual setup in KM:

Unfortunately the selection does not work correctly and i’am stuck seeing why :face_with_head_bandage:

I tried to post the whole macro but i’am a new user and cant post more than 1 screenshot.

Ok, so let’s do this another way -

If I read your rule correctly, then the title of the document will always contain certain defining features; so let’s set up a smart rule which opens the document externally on creation. So, only create the document with KM, then open it from within DT. If Typora is not the app associated with MD, then the rule needs to change to open specifically with Typora (which I think would require a line of script).

Obviously you need to use the location where the item is being created (e.g. in the inbox) as the search location for the script, and whatever defining features the item has (e.g. name contains, size is, kind is…).

Why are you using the URL command?
Bear in mind that is not an x-callback URL (which are not supported in DEVONthink), so it’s not going to return a value.

@Blanc ,

thanks for your idea with the smart rule! Did not think about that.
But how do i figure the matching name?
Everytime i create a new “Zettel” its name will be different.
You propose to always use the same prefixes for a general note?


Thanks for the helpful info - did not knew that.
Is there any other way within the boundaries of Keyboard Maestro to specifically select a newly created markdown document?

Sorry for the split-up post.

As a new user i am only allowed putting one picture in each reply.

Ok, so instead of using the name as a defining feature for the smart rule, use the contents, which will always contain “Note/Resource ID:”, “Schlagwörter:”

An alternative (which I would use if I were using various methods to create such MD files, and they all triggered my smart rule although I didn’t want those from a different source to do so) would be to include a destination in your URL, so that the new file is created in a group (called “new MDs” or whatever) and then moved by the smart rule from there to the inbox and then opened. That would limit your smart rule to those MDs being created in that specific group, so you could use “kind is markdown” as your only criterium.

1 Like

no worries - at this rate you’ll be up a notch in the Discourse food chain in no time :slight_smile: