'Markiables' using plain text variables in standard or boilerplate text

The concept

A text file holds some standard text, including certain choices that the user can make. Taking inspiration from Markdown, these are encoded into the text in a simple way that can then be processed by KM. The encoding takes the following form:

<Choice.|Another choice.|A further choice again.>

The choices are then presented as KM variables and can include alphanumeric characters and simple punctuation.

This means a user can create new boilerplate without having to have a customized KM macro for each instance.

Limitations:

  1. The RegEx only accepts one variable per line.
  2. The RegEx will handle up to 10 possibilities for each variable.
  3. The macro has not been tested with a full range of characters and punctuation marks.

Further development
Though I don't think I have the capabilities, I'd like to see:

  • a way of overcoming the limitation of one variable per line;
  • the introduction of free-text variables;
  • a way of presenting the whole text in the style of TextExpander, perhaps using an HTML prompt?

###Download Macro
Markiables Dynamic Macro Actions.kmmacros (15 KB)
(Moderator: Replaced "Actions" download with "Macro" download)

Can you show some output? I really have no idea what this macro does! :slight_smile:

Input text file (your standard email) that includes certain variables. A simple one-line example:

This weekend I shall be going <back to Miami|back to my girl|on a summer holiday>. 

(It’s possible to have several paragraphs or lines in the text, although the current limitation is for just one variable per line)

The macro reads the text file and presents this part of the file
< back to Miami|back to my girl|on a summer holiday >

as a drop-down in KM:


back to Miami
back to my girl
on a summer holiday


from which you can choose any of the three options. It will loop through and do this for each line which happens to have the < Option1|Option2|etc> pattern.

So, if on a summer holiday is selected then the output would then be text (or should you wish) a mail which reads:

This weekend I shall be going on a summer holiday

1 Like

@Rather, thanks for a great macro.

However, you uploaded a group of Actions, rather than the actual macro.
I have replaced your upload with a macro upload -- same Actions, just as a Macro.

When the user imports Actions, it behaves quite differently than importing a macro. The actions are appended to whatever macro you have open for edit at the time, whereas importing a macro creates a new macro.

So, it is almost always best to upload as a macro. Just click on the Macro name in the macro list before you do your upload.

See:
How to Post/Upload Your Macro to the Forum

1 Like

@JMichaelTX
I think I may have had all of the Actions selected when I did the upload and I hadn’t realized the consequences of doing that.

Thanks for the spot—and more so, thanks for cleaning up after me! I hope it’s clearer to @DanThomas now what it does and I’d also pleased to find out if anyone would be interested in taking this a little further.