gpt4 book ai didi

cocoa - 使用 ScriptingBridge 框架与 Entourage 进行通信

转载 作者:行者123 更新时间:2023-12-03 17:17:27 27 4
gpt4 key购买 nike

我的问题的动机是以下文档,它描述了如何使用 ScriptingBridge 集成 mail.app:

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

我也尝试对 Entourage 应用类似的技术,但到目前为止还没有得到任何结果。我知道使用 AppleScript 可以帮助我解决问题,并且 mactech.com 有大量相关文档。

但我发现这种 ScriptingBridge 技术很优雅,并且想弄清楚为什么它对我的 Entourage 不起作用。

最大的问题似乎是我无法根据 Mail 中的名称创建脚本类,因为 Entourage 的接口(interface)与 Mail 的接口(interface)不同,正如其 header 所示。

有人可以告诉我我缺少什么或提供任何关于为什么这不起作用的提示吗?

我还添加了示例代码

`

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:
@"johndoe@adobe.com", @"address",
nil]];

`

我正在努力让简单的事情发挥作用,我什至没有专注于我现在应该做的任务。

我是一名 Cocoa 初学者(并且愿意学习),请原谅我的语法幼稚,并在回答我的问题的同时在示例代码中指出它们。

最诚挚的问候,

萨勃拉曼尼亚

最佳答案

一些事情:

  1. 如果您遇到困难,请首先弄清楚如何在 AppleScript 中进行操作。这就是大多数应用程序脚本编写者所使用的(即最能帮助您的人)以及几乎所有文档的编写目的。实际上,如果您想做很多应用程序脚本编写,您确实需要学习一些 AppleScript(就像您确实需要学习一些 ObjC 才能从 Python、Ruby 等使用 Cocoa 一样)。

  2. 脚本桥是 clunky, obfuscated and prone to application compatibility problems ,因此将工作的 AppleScript 代码转换为它可能会很棘手(如果不是不可能的话),具体取决于您的目标应用程序、您正在使用的命令等等。根据内存,我认为 Entourage 是它出错的应用程序之一,在这种情况下,除非您求助于使用原始 Apple 事件代码,否则您就不走运了。其他选项有objc-appscript (m'baby),它不太容易出现此类问题,以及 AppleScriptObjC (10.6+),它允许您直接从 AppleScript 调用 ObjC 类,反之亦然。

  3. 你看过CSMail吗? ?

  4. Entourage 将在 Office 2010 中消失,取而代之的是 Outlook,因此您可能不想投入大量时间来弄清楚如何为其编写 SB 代码。

关于cocoa - 使用 ScriptingBridge 框架与 Entourage 进行通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2947576/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com