Without getting into the mostly irrelevant "why", I need to understand the quickest way to assign an action of NX_KEYTYPE_MUTE in KM, if that's possible.
I use an application that listens for NX_KEYTYPE_MUTE, NX_KEYTYPE_SOUND_UP, and NX_KEYTYPE_DOWN in order to execute some functions, and I need to understand how in KM to send that to the application.
I have tried just triggering the F10, F11, and F12 keys on my Magic Keyboard, which are supposed to send those messages, but that is not working.
Thanks!
nola111:
Without getting into the mostly irrelevant "why", I need to understand the quickest way to assign an action of NX_KEYTYPE_MUTE in KM, if that's possible.
I use an application that listens for NX_KEYTYPE_MUTE, NX_KEYTYPE_SOUND_UP, and NX_KEYTYPE_DOWN in order to execute some functions, and I need to understand how in KM to send that to the application.
I have tried just triggering the F10, F11, and F12 keys on my Magic Keyboard, which are supposed to send those messages, but that is not working.
Thanks!
Does it work when you hold down the fn (function) key and press F10-12?
If so then go to System Preferences> Keyboard> Keyboard Shortcuts... > Navigate downt to Function keys. They really burried this well in the lastest versions of MacOS.
Nige_S
January 29, 2025, 9:33pm
3
Did you try just using the corresponding KM actions?
It'll depend on whether those go straight through to the OS or if your app gets them -- but if the app responds to hardware keys it might work.
Yes I have. It does not work.
skillet
January 29, 2025, 10:00pm
5
nola111:
Without getting into the mostly irrelevant "why", I need to understand the quickest way to assign an action of NX_KEYTYPE_MUTE in KM, if that's possible.
I use an application that listens for NX_KEYTYPE_MUTE, NX_KEYTYPE_SOUND_UP, and NX_KEYTYPE_DOWN in order to execute some functions, and I need to understand how in KM to send that to the application.
I have tried just triggering the F10, F11, and F12 keys on my Magic Keyboard, which are supposed to send those messages, but that is not working.
Thanks!
Perhaps try mapping the following AppleScripts to the keys in Keyboard Maestro and see if that works.
Use AppleScript to Send Media Key Events
You can use AppleScript to simulate volume control key events at the system level. Add an "Execute AppleScript" action in Keyboard Maestro and enter:
applescript
CopyEdit
tell application "System Events"
key code 113 -- NX_KEYTYPE_MUTE (F10)
end tell
For Volume Up (F12
/ NX_KEYTYPE_SOUND_UP
):
applescript
CopyEdit
tell application "System Events"
key code 144 -- NX_KEYTYPE_SOUND_UP (F12)
end tell
For Volume Down (F11
/ NX_KEYTYPE_SOUND_DOWN
):
applescript
CopyEdit
tell application "System Events"
key code 145 -- NX_KEYTYPE_SOUND_DOWN (F11)
end tell
nola111
January 29, 2025, 10:02pm
6
Thank you, Skillet, for taking the time to provide this.
I just figured out how to get it to do what I want by using the "Simulate Hardware Key" action of KM. All set now. Thanks!!
3 Likes
skillet
January 29, 2025, 10:07pm
7
That's great I think those may just run an AppleScript in the background or perhaps a Shell Command
osascript -e 'tell application "System Events" to key code 113'
@peternlewis could confirm, I didn't see anything in the Wiki that said and couldn't find on the forum. I am glad you got it working.
https://wiki.keyboardmaestro.com/action/Simulate_Hardware_Key
1 Like
Nige_S
January 29, 2025, 10:35pm
8
I'm not so sure you can -- there's a difference between "hardware key keystrokes" and "function key keystrokes" (you can read more here ).
D'oh! Of course that's the answer -- sorry for the bum steer...
2 Likes