我正在编写一个使用 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 的新手,需要一些指导。谢谢!