I receive an email with a standard format that contains a link to download an invoice. I am looking for a way to automatically click the link and download the file. The visible URL title is always the same.
Go to Settings and look into Rules. You can run an AppleScript to parse the email and open the link.
this opens the link. the downloading part depends.
using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
repeat with eachMessage in theMessages
tell application “Mail” to set t to (content of eachMessage) as string – EDITED
set t to paragraphs of t – ADDED
repeat with i in t
if i starts with “https://” then openLocation(i)
end perform mail action with messages
end using terms from
tell application “Safari” to open location theURL
Thanks. I’m getting closer. The paragraph with the URL does not start with HTTPS, but parsing it should be easy enough as it appears the beginning of the paragraph is consistant.
interesting problem, keep me up to date