How to search replace within a markdown link, and how this led me to new way of working in KM.
I was looking for new applications of the excellent macro Copy as Markdown Link - Macro Library - Keyboard Maestro Discourse (thank you @ComplexPoint ) and this led me to a new way of working in KM.
The problem this solves is the fact that I am usually working on more than 10 macros at a time and it's difficult to keep track of ongoing research pertinent to each macro. I put a keyword in the macro title and create a smart group, but I am limited to storing comments and pertinent website links in comment boxes in those macros which is tedious.
First I found that if I select a macro in KM → Copy as Markdown Link → If I paste that link in a Markdown (Bear) or RTF (Textedit, etc) note, clicking on the link opens the macro in KM editor (does not trigger the macro).
A macro markdown link looks like
~[Anybox](keyboardmaestro://m=D629986E-D53B-4DA5-899A-BADAB11149C3)~
I then found that if I select multiple KM macros → run copy markdown link → the links to all selected macros are batch copied to the clipboard and can easily be batch pasted in Markdown or RTF notes which makes life much easier.
I created a "KM Journal" in Bear (Markdown but could be any RTF editor) in which I list all macros I am currently working on together with a link to each macro, to which I can add notes, links to websites, etc
I than noticed that macro URL triggers have the following structure which is similar to that of the Markdown link above
kmtrigger://macro=AA492269-558C-4D06-933D-091B6A5C0095
What I would now like to do and here is where I have difficulty:
I would like to add to my KM Journal the ability to trigger macros, so for each macro, I will end up with 2 links: one to edit the macro and the other to trigger it.
If I select a macro → copy as Markdown link, I end up with
~[Anybox](keyboardmaestro://m=D629986E-D53B-4DA5-899A-BADAB11149C3)~
I would like to create a macro which would convert the following in the clipboard (the output of copy as markdown link)
~[Anybox](keyboardmaestro://m=D629986E-D53B-4DA5-899A-BADAB11149C3)~
to a clipboard containing 2 links, one to edit and one to trigger the macro
~[Anybox EDIT](keyboardmaestro://m=D629986E-D53B-4DA5-899A-BADAB11149C3)~
~[Anybox TRIGGER](kmtrigger://macro=D629986E-D53B-4DA5-899A-BADAB11149C3)~
The difference being
- the prefix of the edit URL is keyboardmaestro://m= and the prefix of the trigger is kmtrigger://macro=)
- because both links look the same in Markdown (ie Anybox) I want to add "EDIT" AND TRIGGER just before "]"
Thanks in advance for your time and help and sorry for the long post