Cocoa: Simulate Macbook upper keys & Multimedia keys
cocoa, events, macos, simulate
Solution
Media keys are not treated as normal keyboard events, for some reason. This post shows what the events look like.
Problem
I am trying to simulate the upper Macbook keys to any active app using ``` CGEventCreateKeyboardEvent (NULL, (CGKeyCode)keycode, true); CGEventCreateKeyboardEvent (NULL, (CGKeyCode)keycode, false); ``` So far I found and sent the first 4 key's events succesfully: ``` keycode / Key 107 - Brightness Down 113 - Brightness Up 130 - Mission Control / Expose 160 - Dashboard / Launchpad ?? - Keyboard lit Down ?? - Keyboard lit Up ?? - Previous Track ?? - Play/Pause ?? - Next Track ?? - Mute ?? - Volume Down ?? - Volume Up ?? - Eject ``` But I can't find any of the other key codes. I even iterate through 1000 integer sending its numbers as events, no one seems to work =P So, is there any way to simulate these events? Thank you