Surround a Selected Word with an HTML Tag and Paste

Hi, I am sure this was already asked but I am unable to find it. I need a very simple macro: the word in the clipboard should be surrounded by the tag <span dir="rtl">X</span> . X stand for any word in the clipboard.

Thank you!

Show works where tell fails.

You would need to show an example of the output that you want.

'tag' = ?

@ComplexPoint
With tag I meant html tags. And I see that I can´t use them here :slight_smile:
Clipboard has: WORD
Output: <span dir="rtl">WORD</span>

<span dir="rtl">WORD</span>

You can use the %SystemClipboard% token within a text field:


See:
https://wiki.keyboardmaestro.com/Clipboards#Clipboard_Tokens

This is not clear to me. Maybe I was unclear. I copy any word to the clipboard and then I press some hotkey which surrounds it by these tags. Displaying is not required.

I played around with it and this was the solution


Thank you for your help!

If the text you're surrounding by tags is going from one place to another, a one-step solution works well. But if what you want to do is select text and surround it by tags in place, you can save yourself a couple of steps by adding Cut and Paste actions, like this:

2 Likes

Worth actually mentioning those things :slight_smile:

1 Like