Dear All,
I haven’t learned KM yet, but would be happy to, if it can do what I need. I didn’t want to dig in until I have a sense if it can. So I hope I can ask here.
My problem is that I carpel tunnel requires me to mostly get by with just keyboard. I am a writer. I long ago memorized the keyboard shortcuts to use the old (now ancient) menus in Microsoft Word. E.g. alt-T, W -> word count. The newer office on windows keeps these working, somewhat. But not so on the Mac, sadly. And I go back and forth on different machines, and need to.
I am obviously aware that I can create new shortcuts in OSX, but I cannot create successive ones (e.g. alt-T followed by W or alt-W).
Can I use KM to create this? I guess it would be like a macro that triggers when it sees ALT-T (e.g.) and then waits to see what comes next, and, if W (e.g.) then it triggers wordcount.
I think you'll find that Keyboard Maestro (KM) can automate almost anything on your Mac. It is very powerful and very flexible. Feel free to ask any KM question here.
Yes, can be done. It is not hard, but is somewhat of an advanced use of KM.
It makes use of:
Text Expansion (typed string) triggers
RegEx to make trigger dynamic
RegEx to extract option from Trigger actually used
Switch/Case Action to handle multiple options
Here's an example macro that should meet your needs.
Please let us know if it works for you, and/or if you have any questions.
Your starter programming here turned out super helpful and valuable. I’ve filled it out quite a bit. One worrisome thing I just noticed is this: If I have text selected in word when I engage the macro, that text is deleted and replaced with the alt character, e.g. ø. Although running the macro removes the alt character, it doesn’t bring the deleted text back.
Is there some way to engage these two key macros without getting any typing at all? Is that an artifact of the fact that we are using ALT instead of CTRL, for example?
That is the general nature of using text expansion. The text you type (in this case the macro trigger) will naturally replace any text you have selected. That happens BEFORE the macro is even triggered, so it knows nothing about the the text you deleted/replaced by typing.
I think your choices of a workaround are:
Make sure no text is selected before triggering the macro
Use a hotkey for a trigger. The macro would then prompt for the name of the menu item you want.
Thanks again. You’ve done more than could be expected, but I don’t suppose you can point me to an example of someone using a hotkey trigger and prompt?
Thanks, this is cool. I first tried rigging something myself on seeing how you used hotkeys, and it had the unintended effect of this: if ALT-T is pressed it immediately drops the Tools menu.
That could actually be pretty helpful in itself. I could just set those up for the menus I want to drop (tools, file, etc.)
One thing wrong with this approach is that there seems no way to see what keys will activate what choice within a menu. E.g. “w” is word count, but so is “u”, and I see no way to get to Customize Keyboard.
Also, it requires hitting return — I’d prefer to avoid.
The Prompt for User Input idea also requires that return, so I’d rather avoid. I guess I’m looking for: trigger on hotkey THEN WAIT FOR ANOTHER HOTKEY.
The only way I know of is to use a Show palette for one action. You would have to create a dedicated Group, with one Macro for each menu item you want to choose.
It’s up to you, of course, but all that seems like a lot of work just to avoid pressing the RETURN key. It would also be harder to maintain and add new items.
Why don’t you try the Prompt method for a while? I think it’s likely that pressing the RETURN will soon become muscle memory.