0

私は見てみましたが、この一見単純な質問に対する答えを見つけることができませんでした(私もAppleScriptを初めて使用します)。基本的に、ルールを設定し、メッセージをメールボックス「Foo」(IMAPアカウントのメールボックス)に移動するスクリプトが必要です。これが私が持っているものです:

tell application "Mail"
set newRule to make new rule at end of rules with properties {name:"Foo Internal",   enabled:true}
tell newRule
    make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
    set move message to mailbox "Foo"
end tell
end tell

このラインのさまざまな組み合わせを試しました...

set move message to mailbox "Foo"

... IMAPアカウントの指定、変数への設定などを含みます。私はプログラマーではありませんが、これらのルールをスクリプト化したいので、仕事で常にルールを設定しています。何か助けはありますか?

4

1 に答える 1

0

スクリプトは次の2つの理由で失敗します。

  1. should move messageルールのプロパティをtrueに設定することを省略します。これは、move messageアクションが実際に「固執」するために必要です。
  2. ターゲットメールボックスのオブジェクト階層を正しく定義していません。メールではなくルールを対象とするブロック内にいるためaccount、とapplicationコンテキストの両方が必要になります。tell

次のコード:

tell application "Mail"
    set newRule to make new rule at end of rules with properties {name:"Foo Internal", enabled:true, should move message:true}
    tell newRule
        make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
        set move message to (mailbox "Foo" of account "Bar" of application "Mail")
    end tell
end tell

Mail 5.2(OS X 10.7.4以降の在庫)で動作します。

于 2012-07-18T21:22:08.787 に答える