I am trying to write a script for a rule in apple mail, that will automatically find a link in the message of the email, and then download that link to my desktop. I am new to scripting, so I may be way off. Thanks for any help.
using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
tell application “Mail”
set numberOfMessages to count theMessages repeat with eachMessage in theMessages set theSubject to subject of eachMessage set theContent to content of eachMessage get theContent as string try if string contains "http://--" then set result to MyLink if MyLink ends with ".jpg" then set filename to "Macintosh HD:Users:chunky:Desktop:td_" & MyLink save MyLink of eachMessage in filename end if end try end repeat end tell end perform mail action with messages
end using terms from