Macro: Create Variable Token from Selected Text

Hey Folks,

It's pesky to change a variable name into a variable token for use in text fields.

The solution?

A macro of course!  :sunglasses:

This macro will change the selected text in the Keyboard Maestro Editor from:

myVariableName

To:

%Variable%myVariableName%

-Chris


Create Variable Token from Selected Text v1.00.kmmacros (8.6 KB)

1 Like

Hi @ccstone
This is great. But I am just wondering why the Macro needs to be so complicated? This much simpler approach seems to do the same thing. (But I am probably missing something.)

Create Variable Token from Selected Text ALTERNATIVE.kmmacros (2.6 KB)

Hey @Zabobon,

It doesn't have to be.

But I don't want to wait for it to type – I want instant gratification.  :sunglasses:

I was also having some problems with occasional failures, which is why the clipboardseed actions found there way in there.

I later realized that I hadn't escaped the % symbols in my regex, and it was trying to find a variable for the replace text – occasionally causing odd pauses and failures.

-Chris

1 Like

Absolutely. The whole point and joy of computers is to do the work for us and do it quick :grinning: