// // LogScriptCommand.m // Pennyworth // // Created by Chris Karr on 2/19/08. // Copyright 2008 Chris J. Karr. All rights reserved. // #import "LogScriptCommand.h" #import "Context.h" @implementation LogScriptCommand - (id) performDefaultImplementation { NSString * name = [[self arguments] valueForKey:@"from"]; NSNumber * duration = [[self arguments] valueForKey:@"duration"]; NSString * value = [self directParameter]; if (name == nil) name = @"AppleScript Sensor (Contributed)"; NSMutableDictionary * note = [NSMutableDictionary dictionary]; [note setValue:name forKey:OBSERVATION_SENSOR]; if ([value rangeOfString:@";"].location != NSNotFound) { NSMutableArray * components = [NSMutableArray arrayWithArray:[value componentsSeparatedByString:@";"]]; [components removeObject:@""]; [note setValue:components forKey:OBSERVATION_OBSERVATION]; } else [note setValue:value forKey:OBSERVATION_OBSERVATION]; if (duration != nil) [note setValue:duration forKey:OBSERVATION_LIFESPAN]; [[NSNotificationCenter defaultCenter] postNotificationName:OBSERVATION_UPDATE object:self userInfo:note]; return nil; } @end