Mailで添付ファイルを自動リネーム&自動保存
Mailでメール受信(自動的に5分おきくらいにメールチェック)、
ルールでApplescriptを実行して、
HD上の特定のフォルダに添付ファイルを保存したいのですが、
https://discussionsjapan.apple.com/thread/10052314
(添付ファイルの自動保存と発信メールへのルール適用)
上記の質問で、Y._Kawabe-importedさんが、記述されている、
添付ファイルの自動保存スクリプトの例(下記)をもとに、
さらに、『任意の文字列+現在の日時+元ファイル名』という風に
ファイル名を変更して保存したいのですが、どうしたらいいのでしょうか?
たとえば、2013年2月7日10:00:00に
★★★.pdfという添付ファイル付きのメールが送られてきた場合、
XX-130207-10-00-00-★★★.pdf
と変更して保存したいです。
Applescriptはほとんど知識がないので、具体的にスクリプトを記述していただけるとありがたいです。
-----------(Y._Kawabe-importedさん記載スクリプトより引用)-----------
using terms from application "Mail"
on perform mail action with messages messageList
tell application "Mail"
repeat with eachMessage in messageList
set attachmentList to (get mail attachments of eachMessage)
repeat with eachAttachment in attachmentList
set fileName to name of eachAttachment
save eachAttachment in file ("Macintosh HD:Users:hoge:Desktop:添付ファイル:" & fileName)
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
-----------
iMac, Mac OS X (10.6.8)