I'm new to KM. Is there a simple macro to change the style or color of text before I type the next word in a sentence?
Hi @luiz, welcome to the KM Forum.
Here is my solution for writing with different text colors in Apple Mail:
The KM palette is called with the text string trigger "yy" and the text color is changed with the first letter of the macro (R = Red).
If you want to change back to the system font color (here Black), you only have to press the stage key.
Here is the macro for this:
You can make further changes to the font, size etc. in the actions marked with the red arrow:
There is not a "canned" macro to do so, but you could easily create one for your specific needs.
If this is for a specific app, then you could use the Select or Show a Menu Item action to set the color and/or other style. Unfortunately, some apps, like TextEdit do not lend themselves to this type of automation.
So here's a simple, one-action Macro:
It will insert a SPACE that is formatted as you like, and then any following characters you type will use this format.
Starting with this TextEdit document:
after you finish typing "
all", then trigger the macro
and type "good men"
You can format the text in the "Insert Styled Text" Action using the KM menu Edit > Format:
Thanks for your reply and for the macro.
I’m trying it out, but having trouble making it work.
I brought the macro into KM and typed “yy” as the string, but nothing happened. Then I saw that the string is actually “jj”, so I typed that but nothing happened again. What am I missing?
Hi JMichaelTX, thank you for your reply and for your macro. I tried it out, and it worked quite well to make the text red (for instance). The only thing is that when I applied the macro on a TextEdit document and the new red text appeared, it was in a different font size than the previous text in the document. I was trying it out on Text Edit. The same thing happened when I tried it in Mail, except that in this case it also went to the next line as opposed to continuing writing on the same line. Any suggestions?
Hello @luiz, you tried it in Apple Mail? If you enter "jj" in Apple Mail no palette appears?
Please excuse my mistake in my post above. The translation into English would accidentally use "yy" as Text Sting
Hi appleianer, yes, I just tried again typing "jj" in Apple Mail, nothing happens. Could it be that you're using a German keyboard and the "jj" is another letter? Also, after I bring the macro into KM, do I have to do anything else to activate it?
That can be. Please check if the macro group is activated @luiz:
Please replace the Text Stone Trigger with the text you want, so that you can select the desired text color with the starting letter after opening the palette.
Ok, that was the initial problem. Thanks for pointing that out. I activated the macro group now, and when I type "jj", the color palette appears. Do I actually have to choose the color red in the palette with the arrow to make the text red? I thought the macro would run automatically after I typed "jj"....
@luiz with "jj" you call up the palette and then you select your text color with the first letter (R = Red etc.). The text color changes automatically back to the system color when you press the escape key.
@appleianer It works now, thanks!!!
One last issue: when I write text on a new email on Mail I have the font size set up automatically to Helvetica 28, because my vision isn't so good anymore. When I use the macro by typing "jj" and then choose m for magenta, for instance, the new word in magenta is still Helvetica 28, and that's good. However, if I type "jj" and choose r for read, or b for black, the new word appears in Helvetica 12. The same thing happen if I type escape to go back to black. I wonder why. I'd prefer if it would still be size 28 like when I choose m for magenta. Very strange... Do you have any idea why that's happening?
I am glad to hear @luiz that it works now.
Please change the font size in the macros (red arrow) from 12 to 28:
Actually, instead of setting the font size to 28, I left now the font size in the macro UNselected in both places, and it is working now.
Thank you again, you were very helpful, and I think I understand now a little more how KM works!
Have a great Sunday!
Ditto @luiz and it is good to know that it works for you. Not that the day would end like this...
To prevent this from happening... the KM Forum is the best I know.
For some reason, the second part of @appleianer's macro does not work for me.
It works in changing the font to colors other than black. but when I hit Escape, it pastes the black "q" character, but when it is deleted, the color is restored to the non-black color.
@JMichaelTX's simple macro works.
After pasting, however, it adds a line break after the styled "space". Since I usually run the macro after space, I added a "Delete" action both before and after the styled "space". It works great so far.
I don't get the extra RETURN that you are seeing, but IAC I'm glad you were able to adapt my macro to suit your needs.
Yeah, that happened with me sometimes with the Escape key on @appleianer's macro, but somehow it now works fine most of the time. I haven't been able to figure out why.
The problem I have with @JMichaelTX's macro is that besides changing the color to red, it also makes the new text a specific font size (13). Since I write with a different font size (much bigger due to my poor eyesight), I don't want the macro to apply a different font size. I was able to keep the same font size on @appleianer's macro by deselecting the font size box to keep it unchanged, but I don't think I can do that on @JMichaelTX's macro
OK, I have a new version which should fix that.
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.
-~~~ VER: 2.0 2020-09-07 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
Change to Styled Text Starting with Current Style [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
- Change to Styled Text Starting with Current Style
==HOW TO USE==
- First, make sure you have followed instructions in the Macro Setup below.
- In your source document (TextEdit for example) set your normal style and type whatever.
- End your typing with a SPACE character
- Trigger this macro.
- Now Type using the new style from KM
- To return to original style,press the Right Arrow Key.
- 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.
- REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)
- Apply Style to CB: CHANGE to the Style You Want
- KM 9.0+ (may work in KM 8.2+ in some cases)
- macOS 10.11.6 (El Capitan)+
TAGS: @Clipboard @Style @Font
I can confirm it works great. Thanks a lot, @JMichaelTX.
To use the "right arrow" key to return to previous color, we'd better type the right arrow key without typing space, otherwise, there will be two spaces. This method had advantage of returning to whatever the previous color was before the switch.
If we are used to type "space" after every word, @appleianer's method of using "Escape" to return to "black" color might be a good option. This method, strictly speaking, does not return to the "previous color", it returns to whatever color is set by user (in most cases, it would be "black").
Just a tip: If we want to implement @appleianer's method of using "Escape" to return to "black" color, we can simply use "execute a macro" action, so that we don't need to repeat the process again for every different color.
Ok. I spoke too soon.
I get very strange behaviors in different apps.
Scrivener, where I tested initially, it works flawlessly.
Notes (came with MacOS) and Nisus Writer Pro, it does not work at all (not changing text color).
return to it, I need to add a
In "Word", it does not work either, but the cursor goes a step back, as if I had simply clicked the
This is very weird!