Is there any way to emulate NisusWriterPro's type of double keyboard shortcuts with keyboard maestro or AppleScript?

I am using NisusWriterPro as an example. My question is not about NisusWriterPro.

I have been using keyboard maestro for more than 5 years, created many macros, and too many keyboard shortcuts to remember.

I just recently restarted (after a few years) using NisusWriterPro as a RTF editor in DevonThink, and greatly appreciate their keyboard shortcuts which are different from anything that I have seen, and most importantly easy to remember, as opposed to conventional shortcuts.

An example is best suited to explain what I mean:

Let’s say that I want to convert a sentence to a header.

In NisusWriterPro, as with all word processing apps, I can select from a wide variety of header styles. For example, in Scrivener I have to remember the keyboard shortcut corresponding to each header type/style. I other apps (Pages I think) I don’t even have that choice and have to mouse click.

In NisusWriterPro, if I type ⌘H → keep pressing on the ⌘ key → I can press any other key on the keyboard to choose the header style I want. All is configurable. For example if I type in a title → ⌘H keep pressing on the ⌘ key → press the R key, the title turns of centered bold red size 18 (as I configured it).

So my question is how do you call this type of shortcut and can it be emulated in keyboard maestro or AppleScript ?

Note that the default ⌘H global shortcut is inactivated which is fine.

thanks in advance for your time and help

Interesting challenge! The pseudocode would be:

Initial keyboard shortcut to activate the macro
Wait for keypress
If keypress is [x]
    do something
Else if keypress is [y]
    do something else
End if

I can think of two approaches:

  • the KM action “Pause until [keystroke] is down” would sorta emulate the Wait for keypress and If keypress is [x] bits, but you can’t use any key for until [keystroke].
  • You could create two sets of macros. The second set of macros is disabled by default. In the first set, if e.g., cmd +h is pressed, the second set of macros is enabled. The second set triggers on simple hotkeys, like 1. Then it triggers e.g., the heading change you desire via a menu select action, and then it disables the second set again. More on this approach here: https://forum.keyboardmaestro.com/t/pause-until-key-press/4199/9

Might be best to direct these KM-specific questions to the KM forum, though!

1 Like

thank you very much for your suggestions. I will try to work in out using Pause and perhaps Case is better than If Then Else. I did askin the KM forum but people don’t seem interested.
thanks again

I should have added: I think the two-sets macro will work better than the pause until, as it’ll be a bit more amenable to extension.

Good luck!

1 Like

thanks very much for giving my problem so much thought !!

1 Like

@MacSparky also did a free webinar a while back on some Keyboard Maestro where he purposefully used the conflict palette to do something that sounds kind of similar to me.

You assign everything to the same hotkey, but name them in such a way as to filter the list quickly with additional key presses. By simply prefixing an appropriate character to the name, you could in effect produce a combinatory or compound effect.

I had a quick look but I couldn’t find a link to any recording or the like, but a Google search suggests that there are some discussion threads about it over on the MPU forum that may be useful as well.

2 Likes

thank you very much @sylumer. I have been using conflict palettes for years and use many of them on a daily basis. The impetus for my question was precisely to workaround a conflict palette bug which appeared in the recent version of KBM whereby the conflict palette does not deactivate, which causes your computer to go haywire after using a conflict palette because every letter you type which happens to be in the palette triggers a macro.

Was that conflict palette issue not resolved in the 9.0.6 release during the summer?

1 Like

for some users like me, definitely not. I have no clue why.
That being said, you had an excellent idea. I think that I have a way around the conflict palette issue, namely to replace the “conflict” macros ( triggered by the same key) of the palette with subpalettes. There are 2 drawbacks: ↑ ↑ number of macro group palettes and the fact that when you use subpalettes, you forfeit the use of triggers. The only option as a trigger is the first letter of the name of the macro.
thanks again