MACRO: Augment or Filter Text, v2.2

PURPOSE

This macro is used to modify selected text or the clipboard text, if no text is selected. The text can be augmented* or filtered** in many ways. Here are three simple examples:

Task done  →  ~~Task done~~   —one of several Markdown additions

"Hi there."  →  “Hi there.”   —dumb quotes converted to smart quotes
	
local_KMvar  →  %Variable%local_KMvar%  —local_KMvar to KM variable at text

The macro has been designed to provide immediate additions (via dedicated hot keys) for those used frequently; whereas selection from two lists*** for those used less often.

*text Additions can easily be added to the 36 initially configured
**text Filters can be easily added to the 19 initially configured
***there is one Keyboard Maestro Prompt For List for text additions and one list for text filters


DEMONSTRATION

The following video includes four quick demonstrations of this macro: https://youtu.be/Yvnwopo6fio


SETTINGS / HOT KEYS

By default, this macro is triggered using a hyper key (⌃⌥⇧⌘), plus letter T for general use. When this Hot Key is pressed the a text Additions Prompt With List will appear. If one of the 36 default options is selected, the choice will be immediately applied to the text. Alternatively, if /+<return> is typed the Skip below additions, continue to text Filters choice will dismiss the text Additions and a second Prompt With List with text Filters will appear. Here one of the 19 Filter default choices can be similarly applied.

Due to the efficiency of the Keyboards Maestro Prompt With List action, any of the above 55 (35+19) text transformations can be applied to selected text with just a few keystrokes. However, for Additions that are applied frequently, there is an even better option: immediate addition with a designated Hot Key (a.k.a. Immediate Additions). By default, eight additional Hot Keys are set for eight corresponding Immediate Actions.

(In the following selected_text will be augmented with the indicated additional text.)

Hyper+b

**selected_text**

Hyper+I

*selected_text*

Hyper+l

[selected_text](A_LINK)

Hyper+v

%Variable%selected_text%

Hyper+w

selected_text : %Variable%selected_text%

Hyper+x

selected_text
………………………………
%Variable%selected_text%

Hyper+m

DOWNLOAD Macro File:
<mark>selected_text</mark>
*Note: This macro was uploaded in a DISABLED state. It must be ENABLED before > it can be run. If it does not trigger, the macro group might also need to be ENABLED.*

Hyper+f

<details><summary>Macro-image</summary>

selected_text

</details>

If any of the eight above Immediate Additions are not needed, the Hot Keys can be removed from this macro.

Refer to the comments above the two text variables local_Additions and local_Filters for more information about adding Additions, Filters, or Immediate Addition Hot Keys—like the eight indicated above.


TESTED WITH

• Monterey, v12.1; Mojave 10.14.16
• Keyboard Maestro, v10.0.2
• MacBookPro16,1, Macmini6,2


VERSION HISTORY

1.0 - Initial version
2.0 In the Filters section, added:
Smart Smart Single Quotes to Dumb Single Quotes
Reddit User Link to Reddit User
Quoted URL to URL
The three additions to the Filter section employ regular expressions since the Keyboard Maestro Filter action does not provide these options.
2.1 - Bug fix. Delete Past Clipboard 0 should only be executed when %SystemClipboard% <> %Variable%local_SysCb%
2.2

• Added to local_Additions corresponding to the following Hot Keys: Hyper+w, x, m, and f.
• Improved the macro header comments.


DOWNLOAD Macro File:
Augment or Filter Text.kmmacros (88 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.

Macro-image

5 Likes

In the OP, I've updated Augment or Filter Text to Version 2.0.

In the Filters section, added:

  • Smart Smart Single Quotes to Dumb Single Quotes
  • Reddit User Link to Reddit User
  • Quoted URL to URL

The three additions to the Filter section employ regular expressions since the Keyboard Maestro Filter action does not provide these options.


Note: If you previously added to local_Additions and/or local_Filters you'll likely want to make those same additions to Version 2.0.

In the OP, I've updated Augment or Filter Text to Version 2.1.

Bug fix. Delete Past Clipboard 0 should only be executed when %SystemClipboard% <> %Variable%local_SysCb%


Note: If you previously added to local_Additions and/or local_Filters you'll likely want to make those same additions to Version 2.1.

1 Like

Nice macro Jim.

There have been several threads of people asking for how to get this functionality with KM.

Thanks!

1 Like

I've updated the OP with Version 2.2 of Augment of Filterr Text:

  • Added to local_Additions corresponding to the following Hot Keys: Hyper+w, x, m, and f.

  • Improved the macro header comments.