Intermittent copy/paste from System Clipboard

I'm trying to encase the selected text into a full Keyboard Maestro style variable token and then paste it.

For example, if the text "MyVariable" is selected and the macro is triggered, it should be become "%Variable%MyVariable%".

EncaseTextInVariableToken.kmmacros (3.2 KB)

The problem I'm getting is that it only works part of the time. Sometimes it only pastes the selected text (instead of that same selected text encased in a variable).

Could this be from some sort of delay when using the clipboard? If so, inserting pauses doesn't always guarantee I'll get the desired result.

What's going on and/or is there a better way to accomplish this?

Hey Greg,

Try this.


Create Variable Token from Selected Text.kmmacros (4.7 KB)

1 Like

You are using the keystroke ⌘C for the copy, which may not wait for the actual copy to complete. It is much better to use the KM Action Copy.

Here is all you need:


1 Like

@ccstone & @JMichaelTX - both are working for me - thanks for the help :slight_smile: