how to auto download a certain attachment in mail
This is an edited version — quite possibly not the best one — of the script shown in this answer to the Automatically Save Attachments in Mail.app in 10.8 Mountain Lion thread, I've tested it and it works:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
repeat with theAttachment in eachMessage's mail attachments
set attachmentName to name of theAttachment
if attachmentName is "blank expense report" then
set savePath to "Macintosh HD:Users:yourUsername:Inbox:" & attachmentName
try
save theAttachment in file (savePath)
on error err
display display "The Following Error Occurred:" & err
end try
end if
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
This script will save the attachment named "blank expense report" in a named "Inbox" at Machintosh HD:Users:yourUsername:Inbox
. Be sure to change the value of savePath
variable accordingly to your needs.