0

わかりましたので、Mac メール アプリで新しいルールを作成する Apple スクリプトを作成したいと思います。新しいメールを作成し、メールの内容が「AppleScript の開始」である場合、Apple スクリプトを開始します。

これが私がこれまでに持っているコードです:

tell application "Mail"
set newRule to make new rule at end of rules with properties {name:"Apple script rule", forward message:""}
tell newRule
    make new rule condition at end of rule conditions with properties {rule type:message content, qualifier:does contain value, expression:"Start applescript"}
end tell

終わりを告げる

4

2 に答える 2

0

これは機能します。ただし、ルールは正常に機能しますが、これを連続して実行するたびにうまく機能せず、最初に作成したルールに要素を追加しようとするようです。ただし、1 つのルールが作成されるので、それがあります。

パス (2 行目の最後の部分) を、実行しようとしているスクリプトへのパスに変更します。

tell application "Mail"
    set newRule to make new rule at end of rules with properties {name:"Woohoo rule", forward message:"data@data.gov", run script:(POSIX file "/Users/Paul/Library/Application Scripts/com.apple.mail/spam")}

    tell newRule
        make new rule condition at end of rule conditions with properties {rule type:message content, qualifier:does contain value, expression:"run applescript"}
    end tell

end tell
于 2015-12-06T18:31:52.287 に答える
0

あなたが本当に達成しようとしていることはわかりません。

ただし、転送メッセージ:プロパティを空白にすることはできません。つまり、""

そこに何かがなければ、スクリプトは失敗します。

于 2013-05-20T21:27:18.857 に答える