On Sep 18, 2010, at 3:59 AM, Philip Juel Borges wrote: > Thanks Ken for your input.
You're welcome. I'm bringing this back to Cocoa-Dev rather than one-on-one so that others can participate. > I tried the below but it returns this error: > MyReport: unknown type name "OLD message > editor". I have no idea what that message might be or where it's coming from. What do you mean "it returns"? What's "it"? How is it being returned? > The code: > NSString *content = [NSString stringWithFormat:@"%...@\n%@\...@\n", > [self.sumHours stringValue], [self.sumBooks stringValue], [self.sumMagazines > stringValue]]; > > // create a new outgoing message object. The @"content" string refers > to the text area where you write the actual email > MailOutgoingMessage *emailMessage = > [[[mail classForScriptingClass:@"outgoing message"] alloc] > initWithProperties: > [NSDictionary dictionaryWithObjectsAndKeys:content, nil]]; > > What do you think is the problem? You have not constructed a proper dictionary for the message properties. First, you are providing a single object and no key. The -dictionaryWithObjectsAndKeys: method takes a list of object-key pairs followed by nil. Second, you stopped providing a "subject" key. Your original expression for constructing the dictionary was: >> [NSDictionary dictionaryWithObjectsAndKeys: >> [self.subjectField stringValue], @"subject", >> [self.sumHours stringValue], @"content", >> [self.sumBooks stringValue], @"content", >> [self.sumMagazines stringValue], @"content", nil] You had attempted to set the "content" three times, which doesn't work. My suggestion was only a means for setting a single value for the "content" key. It was not a replacement for the entirety of the dictionary. So, for example, you could use the following expression in combination with my suggestion to construct the dictionary for the properties: [NSDictionary dictionaryWithObjectsAndKeys: [self.subjectField stringValue], @"subject", content, @"content", nil] See? You still have to provide a "subject" key and its value as well as a "content" key and its (single) value. The value for the content key has been constructed by combining the several strings you wanted to include. (I chose, arbitrarily, to separate the three strings by newlines. You could format them however you like.) Regards, Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com