Using ScriptingBridge framework for communicating with Entourage

Posted by Subramanian Ganapathy on Stack Overflow See other posts from Stack Overflow or by Subramanian Ganapathy
Published on 2010-06-01T06:05:45Z Indexed on 2010/06/01 6:13 UTC
Read the original article Hit count: 310

Hi,

The motivation for my question is the following doc, which describes how mail.app could be integrated using ScriptingBridge:

http://developer.apple.com/mac/library/samplecode/SBSendEmail/Introduction/Intro.html

I tried to apply a similar technique with Entourage as well but could not get any results so far. I understand that using AppleScript would help me solve my problem and mactech.com has extensive documentation for doing so.

But i find this ScriptingBridge technique elegant and want to figure why it is not working for me with Entourage.

The biggest problem seems to be my inability to create Scripting classes based on their names as it happens in Mail because Entourage has a different interface than Mail as their headers indicate.

Could someone please tell me what I am missing or provide any sort of hint on why this wont work?

I am also adding sample code

`

MicrosoftEntourageApplication * mail = [SBApplication
applicationWithBundleIdentifier:@"com.Microsoft.Entourage"];
MicrosoftEntourageOutgoingEmailMessage * emailMessage = 
[[[mail classForScriptingClass:@"outgoing message"] alloc]
initWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:
@"my sample subject", @"subject",
@"my sample body", @"content",
nil]];

//then i create a set of recipients and try to use "to recipient" as the string scripting class id, but MicrosoftEntourageRecipient is returned as nil 

MicrosoftEntourageRecipient * theRecipient =
[[[mail classForScriptingClass:@"to recipient"] alloc]
initWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:
@"[email protected]", @"address",
nil]];

`

I am trying to make the simple thing work, I am not even concentrating on the task I am supposed to do now.

I am a Cocoa beginner( and willing to learn ), please excuse an syntactic naivetes and do point them out in the sample code, in addition to answering my question.

Best Regards,

Subramanian

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about applescript