1 #import <Cocoa/Cocoa.h>
2 #import <Foundation/Foundation.h>
7 AUTOFRAMEWORK(Foundation)
10 @interface appdelegate : NSObject<NSApplicationDelegate> @end
15 if(OSX_VERSION < 100700)
16 [NSAutoreleasePool new];
18 [NSApplication sharedApplication];
19 NSObject<NSApplicationDelegate> *delegate = [appdelegate new];
20 [NSApp setDelegate:delegate];
22 NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; /* Register a call-back for URL Events */
23 [appleEventManager setEventHandler:delegate andSelector:@selector(handleGetURLEvent:withReplyEvent:)
24 forEventClass:kInternetEventClass andEventID:kAEGetURL];
29 @implementation appdelegate
30 - (void)application:(id)arg openFiles:(NSArray*)file
37 s = [file objectAtIndex:i];
38 print("%s\n", [s UTF8String]);
40 [NSApp terminate:self];
43 - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
45 NSString* url = [[event descriptorForKeyword:keyDirectObject] stringValue];
46 print("%s\n", [url UTF8String] + (sizeof("plumb:") - 1));
47 [NSApp terminate:self];