Saturday, October 1, 2022

#1 2006-09-11 11:21:08 pm

drchunky
Member
Registered: 2006-09-12
Posts: 1

downloading links in an email

Hello,

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


Filed under: mail

Offline

 

#2 2022-08-07 10:09:51 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5568

Re: downloading links in an email

KniazidisR wrote:

What I like about novice users is that they immediately take on the most difficult, probably without realizing what difficulties await them. smile

It is this quality that leads to the fact that they have more interesting ideas than I have. I liked the idea of this user and his courage:


That particular user registered in 2006, posted their one and only question the same day, and hasn't been back to the site since six hours after that. Your reply's sixteen years too late — as I've pointed out to you on several similar occasions before.


NG

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)