0

Entourage Inbox 内で無期限にループし、「未読」メッセージの件名を取得する単純な AppleScript を作成しました。

tell application "Microsoft Entourage"
activate

repeat with eachMsg in messages of folder named "Inbox"
    if read status of eachMsg is untouched then
        set messageSubject to subject of eachMsg as string

        -- bla bla bla

        -- How to delete the message and proceed with the next one???
    end if

end repeat

さて、問題は、件名を取得した後にメッセージを削除したいということです。これどうやってするの?例を書いていただけますか?

再度、感謝します!

4

2 に答える 2

0

以下は、Microsoft の Entourage ヘルプ ページ (具体的には「Nuke Messages」スクリプト) の例の抜粋です。

repeat with theMsg in theMsgs
    delete theMsg -- puts in Deleted Items folder
    delete theMsg -- deletes completely
end repeat 
于 2010-09-15T15:32:46.833 に答える
0

メッセージを削除すると、メッセージ リストの長さが変更されるため、ある時点で、十分な数のメッセージを削除したために存在しなくなったインデックスに遭遇することになります。これを回避するには、(本質的に) ループをハードコーディングする必要があります。メッセージの数を取得し、最後のメッセージから開始してそこから上に移動します。メッセージを削除しても、現在のインデックスより上のインデックスは常にそのまま残ります。テストされていませんが、他の場所で使用したパターンです...

tell application "Microsoft Entourage"
activate
set lastMessage to count messages of folder named "Inbox"
repeat with eachMsg from lastMessage to 1 by -1
    set theMsg to message eachMsg of folder named "Inbox"
    if read status of theMsg is untouched then
        set messageSubject to subject of theMsg as string

        -- bla bla bla

        -- How to delete the message and proceed with the next one???
    end if

end repeat

Applescript の「便利な」構文は、そうでない場合もあります。

于 2010-09-16T14:52:57.727 に答える