| + (NSAppleEventDescriptor*)mm_appleEventWithEventClass:(AEEventClass)eventClass | |
| eventID:(AEEventID)eventID | |
| targetApplicationBundleID:(NSString*)bundleID | |
| { | |
| //NSAppleEventDescriptor *target = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID | |
| // data:[bundleID dataUsingEncoding:NSUTF8StringEncoding]]; | |
| NSAppleEventDescriptor *target = [self mm_targetDescriptorForBundleID:bundleID]; | |
| return [NSAppleEventDescriptor appleEventWithEventClass:eventClass | |
| eventID:eventID | |
| targetDescriptor:target | |
| returnID:kAutoGenerateReturnID | |
| transactionID:kAnyTransactionID]; | |
| } | |
| + (NSAppleEventDescriptor*)mm_targetDescriptorForBundleID:(NSString*)bundleID | |
| { | |
| NSRunningApplication* runningApplication = [[NSRunningApplication runningApplicationsWithBundleIdentifier:bundleID] lastObject]; | |
| pid_t pid = [runningApplication processIdentifier]; | |
| NSAppleEventDescriptor *target = [[[NSAppleEventDescriptor alloc] initWithDescriptorType:typeKernelProcessID bytes:&pid length:sizeof(pid)] autorelease]; | |
| return target; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment