【发布时间】:2011-01-22 02:55:06
【问题描述】:
我正在编写一个使用 Objective-C-appscript (objc-appscript) 与 Mail 对话的应用程序。我想复制当前选择的邮件消息并稍后对其执行一些处理 -- 届时当前选择可能已更改。
MLApplication *mail = [[MLApplication alloc] initWithBundleID: @"com.apple.mail"];
MLReference *ref = [mail selection];
id theSelection = [[ref getItem] copy];
// Do something here, which may change the contents of ref,
// but that's okay since I made a copy in theSelection
MLMoveCommand *cmd = [[theSelection move] to: [[mail mailboxes] byName:@"test"]];
// This command should move the selected messages to the mailbox but fails
// because theSelection
MLReference *ref2 = nil; // Need to turn theSelection into an MLReference *
MLMoveCommand *cmd = [[ref2 move] to: [[mail mailboxes] byName:@"test"]];
我需要将 theSelection 转回 MLReference *。我确信这应该是一个简单的操作,但我是 appscript 的新手,需要一些指导。谢谢!
【问题讨论】:
-
我不确定它是否需要成为 MLReference。相反,我认为它需要是一个 AppScript 列表对象。如何将 NSArray 对象转换为 AppScript 列表对象?
标签: objective-c macos applescript sourceforge-appscript