Here is an example to get you started.
It uses quotes, but you can change those to parenthesis or any character/string you would like.
I have tested this in TextEdit and Word 365, and it seems to work well running Keyboard Maestro 9.2 on macOS 10.14.6 (Mojave).
One caveat: The quotes (or other added characters) may not match the font of the source document unless you specifically apply that font to the KM Set System Clipboard to Text action.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MACRO: Apply Style (Rich Text) to Selection [Example]
-~~~ VER: 1.0 2021-03-20 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Apply Style (Rich Text) to Selection [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
ReleaseNotes
Author.@JMichaelTX
PURPOSE:
-
Apply Specific Styling to Selection and Paste
- The selected text will be replaced with the styled text
HOW TO USE
- First, make sure you have followed instructions in the Macro Setup below.
- See the below "How to Use" Comment Action
- This macro is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
MACRO SETUP
-
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me. ??
.
Make These Changes to this Macro
- Assign a Trigger to this Macro .
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro, and the Macro Group it is in.
- For more info, see KM Wiki article on Macro Activation
.
-
REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)
- Apply ONLY Foregroud Color to System Clipboard
- Change to whatever styling you want for the selected text
- Set System Clipboard to Styled Text
- Change the style of the quotes as you want.
REQUIRES:
-
KM 9.0+ (may work in KM 8.2+ in some cases)
- macOS 10.12.6 (Sierra)+
TAGS: @Example @Clipboard @Style @RichText
USE AT YOUR OWN RISK
- While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
- If you have any doubts or questions:
- Ask first
- Turn on the KM Macro Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.