Text Expander like variables in KM?

Hi

I was wondering if it would be possible to have TE like variables in text; e.g. Dear or Item price like $5 or $10 or $20 or pop-up menu etc.

At the moment I’m using “Insert text by pasting” KM action for various basic things like cell phone number etc. However, I would like to draft a couple of email snippets that would require inserting variables.

Thanks.

Something like this:


[Demo]Text Expansion with Variables.kmmacros (3.4 KB)

2 Likes

@Tom, that's an excellent example of using KM for text expansion. Would you mind if we use it as an example in the KM wiki?

1 Like

It’s yours :wink:

Or, as a demo, maybe this one is better:


[Demo]Text Expansion with Variables #2.kmmacros (3.4 KB)

1 Like

Hi @Tom

I have the following Apple script that will take the recipient’s first name and put it after “Dear” and I’m wondering how do I attach it to your macro.

I’m currently running this macro as a typed string “nm” - execute apple script - paste result.

tell application "System Events"
tell process "Mail"
tell text field “To:” of window 1
if UI element 1 exists then
set theToRecipient to (value of UI element 1)
if (count words of theToRecipient) is greater than 0 then return word 1 of theToRecipient
end if
end tell
end tell
end tell

Like this:


[Demo]Text Expansion with Variables #3.kmmacros (4.2 KB)

1 Like