Saturday, February 27, 2021

#1 2005-01-09 06:28:12 pm

jasonshah
Member
Registered: 2003-07-11
Posts: 3

Highlight Apple Mail message a color with keyboard

Hello,

I want to be able to press a keyboard combination and change any highlighted message (or messages) to a specific color.  For example, if I press 1 (or Cmd-1 or some other combination) with a message selected in Apple Mail, the message will change to background color red,  2 will change to green, etc.  This is similar to what Mozilla Thunderbird can do.

I am new to Applescript, and I am having trouble creating even a very simple one to do this.  I named the applescript Red, and it will take one message and color it red.  I wrote it as follows:

tell application "Mail"
    set background color of message to red
end tell

It does not work.  Does anyone have suggestions to 1. make it work, and 2. make it work when multiple messages are selected at once?  Thanks for the help!

Jason


Filed under: mail

Offline

 

#2 2005-01-09 08:49:48 pm

redsweater
Member
From:: Somerville, MA
Registered: 2003-04-12
Posts: 57
Website

Re: Highlight Apple Mail message a color with keyboard

Hi Jason - you need to identify the target message more specifically:

Applescript:


tell application "Mail"
   set theSelection to selection
   set thisMessage to item 1 of theSelection
   set background color of thisMessage to red
end tell

Or, to do it for all selected messages

Applescript:


tell application "Mail"
   set selectedMessages to selection
   repeat with thisMessage in selectedMessages
       set background color of thisMessage to red
   end repeat
end tell

[plug]
And if you don't already have a solution for attaching the script to a keystroke, my FastScripts utility would be an excellent choice, I think smile
[/plug]

Hope this helps!

Daniel Jalkut
www.red-sweater.com


Filed under: mail

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)