Text Reformatting - Way to get choice of what kind of formatting to apply?


#1

I would like to replicate something that was easy to do in QuicKeys:

I need to reformat text in various ways (sometimes all caps, sometimes all lower case, sometimes initial caps, etc).

What I would like to do is highlight the text, hit a trigger that brings up a dialog box (or whatever) that allows me to select the format I want from a list of options. Ideally, I would like to be able to navigate through the options using the keyboard (up and down arrows??), rather than having to reach for the mouse. I know I can make a separate macro/trigger for every text style I need, but I don't want that - I would like to be presented with a list of options...

Can this be done?


#2

I don't know how QuicKeys did it, but yes, this can be done in KM. Personally, the way I've traditionally done this is to make separate macros for each format, assign them the same trigger, then choose an option from the resulting conflict palette:

23%20PM

However, if you don't want to go that route, you now have another excellent option thanks to the Prompt With List action added in KM 8, which can not only be navigated with the up and down arrows the way you would like, but can also be configured to show what the resulting text formatting will look like before it is applied:

Select Text
34%20PM

Trigger Macro
36%20PM

Make Selection
39%20PM

Hit Enter, Selected Formatting is Pasted
39%20PM

Of course, if you'd rather just select from a simple list of options without always seeing what the text will look like before pasting, you can do that as well:

54%20PM

But I'm guessing the version that shows the resulting transformation will be more useful more often, so that's the version I'll post here:

Format Text.kmmacros (6.4 KB)
image

Questions?


#3

January 8, 2019

Hi Gabe:

Many thanks for the suggestions.

I tried the Format Text.kmmacros and ran into numerous problems:

  1. If I have multiple lines of text selected, the macro will delete all but one line of text when it does the reformatting. This alone is enough to make the macro unusable.
  1. Sometimes the formatting will not work if I try to apply a different formatting after I have already applied a format. (In other words, if I choose all caps, it will do that, but if I then choose upper lower, if often will not apply that.

I don’t know if there are fixes for these problems, but if you figure something out, let me know.

In the meantime, I will experiment with the first method you had mentioned (using the same trigger to multiple macros, then use the conflict pane) and see if I can get that to work.

Tomas


#4

Hi Tomas,

No problem. Sorry for the issues with the example macro; I usually only format single lines of text myself, and had forgotten how the Prompt with List action handles multiple lines in text and didn't test it thoroughly enough before posting. It is still possible to include a preview with Prompt with List, but I'm afraid that developing and testing such a macro would require more time than I can spare at the moment. If you don't need the formatting preview, try this new version that only offers a list of formatting options; it should resolve both of the issues you found with the last version:

Format Text v2.kmmacros (5.7 KB)
image

If you're interested in the conflict palette method, here are the same macros I use, all bound to Ctrl-C (as well as Ctrl-1 through 5, which also lets you activate them individually more quickly without taking away the option to choose from a list). They should help you get started.

Text Formatting Macros.kmmacros (16.8 KB)


#5

January 23, 2019

Hi Gabe:

Finally have had time to look at your revised text reformatting macros – I like the new version (Format Text v2.kmmacros). Thanks much for your help!

T