Create HTML list from selected lines of text


This is Line 1
This is Line 2
This is Line 3

I would like to select that text and have a macro convert it to

	<li>This is Line 1</li>
	<li>This is Line 2</li>
	<li>This is Line 3</li>

Can anyone help? TIA.

Hi @Sridhar,

Fortunately, this is very easy to do with the built-in Filter Clipboard action. Here's a sample macro that should do exactly what you want. Feel free to change the trigger or disable the copy or paste actions to better suit your needs.
Create HTML List from Selected Text.kmmacros (2.1 KB)

Thank you.

This works fine by itself.

However, it does not work when I paste the generated AppleScript code inside a custom action of LaunchBar. (no such problem running other KM macros as LB actions)

I'll keep trying..

The Copy action is failing to copy something.

That is, Keyboard Maestro is simulating a Command-C, but the clipboard is not changing.

Figure out why that might be (perhaps because you are currently in LaunchBar rather than in the target application?) and that should resolve your issue. It might just be that you need a short pause at the start of the macro for the LaunchBar window to go away for example.

Thanks @peternlewis. That did it! Also had to simulate pressing Esc first to dismiss LaunchBar's bar so the focus is in the app having the text to be processed.