// // EntourageConduit.m // Task Views // // Created by Chris Karr on 2/24/09. // Copyright 2009 Chris J. Karr. All rights reserved. // #import "EntourageConduit.h" #import "KFAppleScriptHandlerAdditionsCore.h" #import "KFASHandlerAdditions-TypeTranslation.h" @implementation EntourageConduit - (NSString *) identifier { return @"ID"; } - (NSArray *) fetchTasks:(NSDictionary *) options { NSBundle * bundle = [NSBundle mainBundle]; NSString * script = [bundle pathForResource:@"Entourage" ofType:@"scpt" inDirectory:@"Conduits/entourage_conduit"]; NSMutableArray * tasks = [NSMutableArray array]; NSDictionary * error = nil; NSAppleScript * as = [[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:script] error:&error]; if (script != nil) { NSAppleEventDescriptor * descriptor = [as executeAndReturnError:&error]; id list = [descriptor objCObjectValue]; if ([list isKindOfClass:[NSArray class]]) { NSEnumerator * listIter = [list objectEnumerator]; id value = nil; while (value = [listIter nextObject]) { if ([value isKindOfClass:[NSDictionary class]]) { NSMutableDictionary * task = [NSMutableDictionary dictionaryWithDictionary:value]; [task setValue:@"Entourage" forKey:@"source"]; [tasks addObject:task]; } } } } else { // Check error } return tasks; } - (void) openExternalSite:(NSDictionary *) options { [[NSWorkspace sharedWorkspace] launchApplication:@"Entourage"]; } @end