Boilerplate email with fill-in-the-blanks

I have to send a lot of boilerplate/standardized emails for work, but they are too irregular for a mail merge to be helpful. So I came up with this solution that acts on currently selected text. I store my boilerplate text files in nvALT. When I need to run one, I just open it and select the text and execute the macro. The text contains placeholder flags that prompt the macro to turn them into fill-in-the-blanks.

Here's an example of the kind of text I would use:

SUBJECTYour Magazine photographer
Hi Dr. xxxDoctors_Name,

Thanks again for your willingness to be photographed for our magazine.

Your photographer, xxxPhotographers_Name (CCed), will be following up with you to set up a convenient time and location for your shoot.

Please let me know if you need anything. Thanks!

Here's a basic overview of the macro:

  1. Gets the text and saves it to a variable for macro operation (original text file in nvALT is unchanged)
  2. Searches for any placeholder string that begins with "xxx"
  3. Creates a variable for that text and prompts the user to assign a value to that variable
  4. Goes back through the text and overwrites the placeholder string with the user-assigned variables
    [Steps 2–4 are repeated for all placeholder text with a "For each" action.]
  5. Finds a string that begins with "SUBJECT"
  6. Sends everything to a new email message

(I know TextExpander supports fill-in-the-blank snippets, but I find them clumsy, and I much prefer to store my boilerplate text in nvALT, where I can get to it easily.)

If anyone has suggestions for improvement, I'd be interested to hear them.

BPT.kmmacros (7.5 KB)

3 Likes

This is great. I am going to have to look into it further. I don't understand how the placeholder works but I have been a big fan of Notational Velocity and nvALT, being a port of Notational Velocity, should be pretty close to use.

So Jack, all I have to do is place three Xs before what ever I want to note as a 'fill in the blank'?

Tunes, I apologize for the slow response!

Yes, you are correct, just use xxx before the placeholder text.

Thanks Jack!