Help with developing text automation and slipping document


I am trying to write a maestro script which will do the following from text documents in markdown.

  • extract the long title
  • extract short title
  • for each point separate into a new file with formatting

The text files that I have are formatted as below:

20190119122238 - §Reznic, NEJM, 2012
Tags: #inbox #cardiacdevices #surveillance
Source: Resnic, postmarketing surveillance of medical devices–filling the gaps, 2012, NEJM: 366: 875.

Study design: Editorial

Medical devices are complex items and failure of any one of the components can result in serious adverse consequences.

There is never going to be a completely safe medical device.
[[Reznic, NEJM, 2012]]

I am to automatically export these to the following format:
[Current time]
Source [longreference]

[extracted paragraph]

[short reference]

Below is my attempt however I am having trouble debugging.

Is anyone able to help?



In sorry I am told I should have added the macro as an upload. So here goes :slight_smile:

zz automate creation of notes from large note.kmmacros (4.6 KB)


Hey Jd,

I spent quite a while looking at your macro, and I'm sorry to say that I don't have a good enough picture of your workflow to help very much.

You can try posting a more complete explanation of your task if you like.

But – the place to start is over again and from the top.

Disable every action.

Get the first action working correctly and move down action by action.

When you're putting together text in variables you can look in the variables panel of Keyboard Maestro's preferences.

And/Or – you can use a Display Text action with the in-window option to properly visualize it.

Example – your write-file action didn't have a complete path. I believe it ended with a .

You should have a full featured text editor like BBEdit for testing regular expressions.

(BBEdit is commercial, but it reverts to lite mode after a 30 day demo period. Even in lite mode it is significantly more powerful than the freeware TextWrangler used to be. It continues to be fully AppleScriptable and its regular expression support is unhampered.)

Note – Keyboard Maestro actions in macros can be renamed to clarify what they are doing.


Take Care,