def registerURLHandler(self): event_class = event_id = fourcharToInt("GURL") event_manager = NSAppleEventManager.sharedAppleEventManager() event_manager.setEventHandler_andSelector_forEventClass_andEventID_(self, "getURL:withReplyEvent:", event_class, event_id) bundleID = NSBundle.mainBundle().bundleIdentifier() LaunchServices.LSSetDefaultHandlerForURLScheme("sip", bundleID) LaunchServices.LSSetDefaultHandlerForURLScheme("tel", bundleID)
def applicationWillFinishLaunching_(self, notification): man = NSAppleEventManager.sharedAppleEventManager() man.setEventHandler_andSelector_forEventClass_andEventID_( self, "openURL:withReplyEvent:", struct.unpack(">i", "GURL")[0], struct.unpack(">i", "GURL")[0]) man.setEventHandler_andSelector_forEventClass_andEventID_( self, "openURL:withReplyEvent:", struct.unpack(">i", "WWW!")[0], struct.unpack(">i", "OURL")[0])