CGEventCreateKeyboardEvent and Sandboxes
I'm trying to do this piece of code to send keystrokes to a finder in a sandboxed application for Mac OS X:
CGEventRef a = CGEventCreateKeyboardEvent(NULL, keycode, true);
CGEventSetFlags(a, kCGEventFlagMaskControl);
CGEventPost(kCGHIDEventTap, a);
CFRelease(a);
It works in a non-sanboxed environment, but it doesn't work when it is isolated, also if I use this right:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.systemevents</string>
</array>
</dict>
</plist>
I found someone suggested to use Apple Scripts instead, it works but it is very slow and not suitable for my needs.
Is there a chance?
+3
Fabrizio farenga
source
to share
No one has answered this question yet
Check out similar questions:
6
3
2
2
1
0
0
0
0
0