On Sep 17, 2010, at 6:37 AM, PJBorges wrote:

> In my app I have a feature that opens Mail.app. The feature extracts
> the contents of a number of labels into the message area of Mail, but
> it is only the first label that is extracted, the rest are not.
> 
> 
> My code:
> MailOutgoingMessage *emailMessage =
>       [[[mail classForScriptingClass:@"outgoing message"] alloc]
>        initWithProperties:
>        [NSDictionary dictionaryWithObjectsAndKeys:
>         [self.subjectField stringValue], @"subject",
>        [self.sumHours stringValue], @"content",
>        [self.sumBooks stringValue], @"content",
>         [self.sumMagazines stringValue], @"content", nil]];
> 
> How can I extract more than one label?

You are building a dictionary.  For any given key (like "content"), a 
dictionary may only have one value, although the value may be a collection (but 
probably not in this case).

You probably want to construct a single string from the respective fields.  How 
you want to do that -- that is, the actual content you want the mail message to 
have -- is up to you.  A likely technique would be to format the fields 
together with something like:

NSString* content = [NSString stringWithFormat:@"%...@\n%@\...@\n", 
[self.sumHours stringValue], [self.sumBooks stringValue], [self.sumMagazines 
stringValue]];

Cheers,
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

Reply via email to