// // AppDelegate.m // CopyMailto // // Created by tw on 9/5/18. // Copyright © 2018 tw. All rights reserved. // #import "AppDelegate.h" @implementation AppDelegate - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetLocationMail andEventID:kAEOpenApplication]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { // Insert code here to tear down your application } - (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; NSLog(@"%@", url); } @end