How would I go about having a keyboard shortcut which would set the color of an email in mail.app? I'm talking about the color of the email in the list not the color of the text, . Ordinarily this is done by clicking on an email and then the colors panel and selecting a color and closing the panel.
I'm not sure that's the same thing. I think OP is referring to "colour-coding" (although a quick try at following those instructions did nothing on my machine).
Hey @ihf,
Use an Execute an AppleScript action to run this AppleScript, after selecting the messages you want to alter.
-Chris
--------------------------------------------------------
# Auth: Christopher Stone <scriptmeister@thestoneforge.com>
# dCre: 2023/05/19 08:17
# dMod: 2023/05/19 19:33
# Appl: Mail
# Task: Set Background Color of Selected Messages in Message List.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Set, @Background, @Color, @Selected, @Messages
--------------------------------------------------------
tell application "Mail"
set selectedMessageList to selection
if selectedMessageList β {} then
repeat with theMessage in selectedMessageList
tell theMessage
set its background color to red
set its read status to not (get its read status) -- Force color to show.
set its read status to not (get its read status) -- Restore previous read status.
end tell
end repeat
else
error "Zero messages were selected!"
end if
end tell
--------------------------------------------------------
(*
AVAILABLE COLORS:
blue
gray
green
none
orange
other -- I'm not aware of a means to use βotherβ
purple
red
yellow
*)
--------------------------------------------------------
@ccstone Thank you! That looked very promising but I opened it in Script Editor to test and select an email in the mail.app and ran it but nothing changed.
I think an extra line has snuck in there -- delete the
return its background color
...line and try again.
Note that the background colour is masked when the mails are selected, so it isn't immediately obvious that the colour has been set.
Perfect! Thanks very much!
Quite right β thanks for catching that!
I was looking to see if I could discover the format for the βotherβ color and neglected to remove the offending line.
I've fixed the posted script...