OS X El capitanを使っています.ezwebで受信したメールをGmailに転送し(auのEメール設定で,自動転送するようにしています),そのうちの,特定のメールアドレスの添付ファイルを保存する,という作業をApple Scriptで行おうとしています.そこで,SaveAttachment.scpt
に
tell application "Mail" --Seach a particular address in the selected messages set messageList to selection repeat with curMessage in messageList set meSender to (sender of curMessage) --If its address is what I want if (meSender contains "hoge") then --If the message has attachments; the hilighted line when this script is to work if (mail attachment of curMessage exists) then repeat with mailFile in (mail attachment of curMessage) --save it as a file "~/Desktop/mail/meSender_fileName save mailFile in POSIX file ("/Users/username/Desktop/mail/" & (meSender) & "_" & (name of mailFile)) end repeat end if end if end repeat end tell
と書きました.これでほとんどのメールについては問題なく保存できたのですが,なぜか一部のメールではmail attachment of curMessage exists
がハイライトされ,
error "Mail でエラーが起きました:AppleEvent のハンドラで誤りが起きました。" number -10000
とエラーが発生し,添付ファイルを保存することができませんでした.Mailアプリで開いてみると添付ファイルはたしかに存在し,保存することもできました.Mailアプリで見た限りでは他の保存可能なメールとの違いは分かりません.
何が原因なのでしょう.また,どうすればエラーを回避できるのでしょうか.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。