質問

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

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

再度、感謝します!

役に立ちましたか?

解決

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

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の「利便性」構文がそうでない場合があります。そのため、通常は完全に回避します。

他のヒント

これは、MicrosoftのEntourage Helpページ(具体的には「Nuke Messages」スクリプト)の例の例からのスニペットです。

repeat with theMsg in theMsgs
    delete theMsg -- puts in Deleted Items folder
    delete theMsg -- deletes completely
end repeat 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top