1

I'm trying to write an Applescript (my first) to change the font of incoming emails using a rule in Mail.App. In particular, some tasteless individuals use Comic Sans, and I want to change their emails to Helvetica, thus saving my eyeballs.

I've added a rule to Mail.App which triggers the following Applescript on emails from these offenders. It works without error, but doesn't change the font. Any advice, please?

using terms from application "Mail"
    on perform mail action with messages theMessages for rule thisRule
        repeat with theMessage in theMessages
            tell theMessage
                try
                    set font of content to "Helvetica"
                on error e number n
                    my logit("OOPs: " & e & " " & n, "MailScript")
                end try
            end tell
        end repeat
    end perform mail action with messages
end using terms from

to logit(log_string, log_file)
    do shell script ¬
        "echo `date '+%Y-%m-%d %T: '`\"" & log_string & ¬
        "\" >> $HOME/log_" & log_file & ".log"
end logit

Thanks!

  • Firstly, welcome to Ask Different! :) I hope you come to find this site has a lot to offer! In case you haven't already, it's worth taking the time to read the tour. All the best with your question! – Monomeeth May 21 at 0:14

You must log in to answer this question.

Browse other questions tagged .