Send NSEvent to background app
I need to send the key combo ^⌘C to a background app with the bundle identifier com.company.app . The key combo should then activate a menu item in that application. Unfortunately, I have no clue how to do that. Some research pointed me to the NSEvent and CGEvent API using CGEventPostToPSN() , but I was unable to get it work correctly, as I don't know how to set up the key combo. CGEventPost() didn't seem to work with the events I created, even if the desired app is the active one. Here is the code I eventually came up with but that doesn't work: CGWindowID windowNumber; NSEvent *event =