osascript to trigger a hot key with multiple modifier keys in OBS Streamlabs is not working
OK, here is a workaround to the problem. Unfortunatley, this really isn't an answer as it doesn't explain why, at the lower OS level, the problem exists in the first place. It just works around the limitation by mapping key strokes with one or more modifiers to single keystrokes. Perhaps people who are more familiar with the keyboard at the lower levels of the OS can use this solution to figure out what might be happening.
Anyway, as mentioned, OBS Streamlabs can respond to single keystrokes as hotkeys that are simulated with applescript. For example, you can tell OBS to recognize &quot;1&quot; on the number pad as a hotkey. The problem, of course, is that using a single key as a hotkey will also generate that character in the terminal or any other app you are working in. So the trick is to tell OBS to set up a hotkey for numkey 1 and then remap a key stroke with one or more modifier keys to that single numkey 1 keystroke.
The low-level remapping can be accomplished with the free app Karabiner elements
So, using the app, I remapped the command + Num-1 combination to Num-1. So now when I run this simple script from the command line...
osascript -e &quot;tell application \&quot;System Events\&quot; to key code 83 using command down&quot;
...no character gets printed by the key stroke simulated by the one-liner above and the hotkey now gets triggered.
By they way, I could not figure out how to send keyboard output generated by an apple script to /dev/null. It doesn't appear to be possible, as best I can tell. So something like command + Num-1 that creates a &quot;silent&quot; keystroke is needed.
So, with this method, I can have a hotkey for all the rarely used keys on the keypad. I can also use all function keys that are not getting used by another app.