Produce a Representative String for a Command-Key Keyboard Shortcut

For some reason that I cannot explain, your explanation is perfectly clear and now I realize exactly what he wants. (Although we still aren't sure which combinations of modifiers he is interested in. And we don't know which keys he wants the modifiers to work with.)

==BELIEVE IT OR NOT, I think I have a solution!!!== But I need someone who knows AppleScript to help a little bit. I need to be able to turn the modifier keys completely off, using an AppleScript command, doing in AppleScript what you can see here: (turning these four options off).

I've done some preliminary testing, and it works for ASCII keys, and I think I can make it work for Hotkeys also, without hundreds of triggers. All I would need is a single trigger to cover all the ASCII keys, that looks like this:

Plus I would need to add UNMODIFIED hotkey triggers for the remaining USB keyboard keys (about two dozen keys?) So I wouldn't need a hotkey for both CMD-End and End, just for End, because the modifiers would be detected independently, after the KM engine captured the End key (and re-enabled the modifiers.)

If you don't understand my method, don't worry about it. But if someone can give me the AppleScript that I requested, I think I can handle the rest.

Here's a work in progress, that works.

You type two commas to initiate the substitution and then a 'c' for the Command key symbol, 'o' for Option key, 's' for Shift and/or 'z' for Control, followed by anything else to complete the trigger.

The macro will print the equivalent symbol in the order the macro looks for it. That maintains consistency in the overall text (Shift will always appear before Control, for example).

I thought this would work with a simple Switch action (which, if I'm reading the docs right, evaluates every case) but it doesn't. So I've used four If actions.

Anyway, as it is, it lets you use simple letters to build a key chord and print its symbols.

Update: The new version looks at the front window's title to see if you're writing HTML and, if so, uses the unicode for these symbols. Otherwise, it uses the symbols.

Another Update: The latest version builds the chord in a local variable so only one Insert Text by Pasting is used, making insertion faster.

[Test] Enter Modifier Key Symbols.kmmacros (14 KB)

1 Like

There's always this:

https://robservatory.com/a-much-improved-special-character-palette/

or this:

1 Like

Sorry — late and perhaps not apt, but I use KeyCodes for this.

I use the symbol strings in a database tracking what I've always called Keychords, because I think Keychords is more precise and easier to use than "keyboard shortcuts". I use a Moonlander programmable keyboard, which allows four keychords per key per layer without any modifier keys. It's a lot to keep track of.