Objective-C-appscript (objc-appscript) を使用してメールと対話するアプリを作成しています。現在選択されているメール メッセージのコピーを作成し、後で処理を実行したいのですが、その時点で現在の選択が変更されている可能性があります。
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 が初めてで、いくつかのガイダンスが必要です。ありがとう!