Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 02-17-2005, 01:52 PM   #1
ibroughton
Guest
 
Posts: n/a
Mail colors / flags

Is there any way to manually apply a color to a message background? I know you can do this using Rules, but can it be done on a case by case basis when I want? I know entourage cam do this with Categories and prjoects, but I really don't want to go back to Entourage, even if it means highlighting the message and running an applescript.
I know the colour of the text can be changed using MailPriority application, but I easily over look these, so having the background of the subject line (like in Rules) would be a far better option.


Any ideas?

Last edited by ibroughton; 02-17-2005 at 02:08 PM.
  Reply With Quote
Old 02-17-2005, 04:43 PM   #2
cudaboy_71
All Star
 
Join Date: Jan 2002
Location: sacramento, ca
Posts: 874
i know what youre getting at. i'm just trying to remember if this is an option in the tiger preview of mail.app or not. seems like there was all kinds of goodies to look forward to.

in the case of what we have available now, i cant help with the labels. but, i thought i'd point out what you'll probably find painfully obvious--but, you did mention it in the thread title.

there are 'flags' that can be applied to messages. cmd-shift-L
cudaboy_71 is offline   Reply With Quote
Old 02-17-2005, 05:23 PM   #3
bramley
MVP
 
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
It is true that Apple didn't include the means to change colours except in the rules ... but they did include the ability in Mail's Applescript dictionary. Why!!? I dunno.

But here is a script that works. Select all the messages you like, and start the script. There are 8 possible colours (inc. none) to choose from. Obviously, you can only choose one. Error message comes up if you've selected nothing.

Code:
property textColours : {"blue", "gray", "green", "none", "orange", "purple", "red", "yellow"}
using terms from application "Mail"
	property colours : {blue, gray, green, none, orange, purple, red, yellow}
end using terms from

on run
	tell application "Mail"
		activate
		if (selection is not {}) then
			set response to choose from list textColours with prompt "Select a background colour from list" without multiple selections allowed
			if (response is not {}) then
				set currentTextColours to textColours
				set currentColours to colours
				repeat until (first item of currentTextColours = (response as string))
					set currentTextColours to rest of currentTextColours
					set currentColours to rest of currentColours
				end repeat
				set colourToUse to first item of currentColours
				copy selection to messagesToChange
				repeat with aMessage in messagesToChange
					set background color of aMessage to colourToUse
				end repeat
			end if
		else
			beep
			display dialog "Cannot apply colour as no messages have been selected." with icon stop
		end if
	end tell
end run
To run the script put it in /Library/Scripts/Mail Scripts/, and click 'Update Script Menu' in Mail Scripts Menu. You can also run the script from the system's Script Menu (which I prefer to do).
bramley is offline   Reply With Quote
Old 02-17-2005, 05:29 PM   #4
cudaboy_71
All Star
 
Join Date: Jan 2002
Location: sacramento, ca
Posts: 874
nice! thanks for that.
cudaboy_71 is offline   Reply With Quote
Old 02-17-2005, 05:34 PM   #5
HazyJMac
Major Leaguer
 
Join Date: Jan 2004
Location: Gulf Shores, Alabama
Posts: 465
Here is a method using applescript thanks to Mac OS X Panther Hacks. O'Reilly Press. Authors: Rael Dornfest and James Duncan Davidson.

Here is the Code

--Colorize Mail.app messages--

using terms from application "Mail"
on perform mail action with messages msgs
tell application "Mail"
repeat with msg in msgs
set background color of msg to orange
end repeat
end tell

end perform mail action with messages

on run
tell application "Mail" to set selectedmsgs to selection
tell me to perform mail action with messages selectedmsgs
end run
end using terms from

Now, save the code to a file named something like this. I'll use the example in the book. ASAP-Orange___ctl-o.scpt That's three underscore characters between Orange and ctl. The (___o.scpt) portion of the file name assigns a Keyboard shortcut allowing you to select a message and press Control-O to label that message orange.

Save the script in your /Library/Scripts/Mail Scripts folder.


You can make scripts for any of the Available colors: blue, gray, green, orange, purple, red, and Yellow. All you need to change in the script is the name of the color. And when saving, change the (___ctl-o.scpt) portion to (___ctl-"First letter of Color".scpt) to match the color you used in the script

ex.
set background color of msg to gray

save as......... Gray___ctl-g.scpt

Be sure to create one with the color none to get rid of a color label.
Hope that's helpful.
HazyJMac is offline   Reply With Quote
Old 02-17-2005, 05:38 PM   #6
HazyJMac
Major Leaguer
 
Join Date: Jan 2004
Location: Gulf Shores, Alabama
Posts: 465
Whoops
Must of been writing that as bramley was posting.
HazyJMac is offline   Reply With Quote
Old 02-17-2005, 05:52 PM   #7
bramley
MVP
 
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
The odd thing is that the dictionary also claims there is a colour called 'other'.

Code:
Class message: An email message
Plural form:
	messages
Elements:
	bcc recipient
	cc recipient
	recipient
	to recipient
	header
Properties:
	<Inheritance>  item  [r/o]  -- inherits elements and properties of the item class.
	all headers  plain text  [r/o]  -- All the headers of the message
	background color  blue/gray/green/none/orange/other/purple/red/yellow  -- The background color of the message
	mailbox  mailbox  -- The mailbox in which this message is filed
	content  text  -- Contents of an email message
	date received  date  [r/o]  -- The date a message was received
	date sent  date  [r/o]  -- The date a message was sent
	deleted status  boolean  -- Indicates whether the message is deleted or not
I did try and see what would happen if I used 'other', but disappointingly it simply crashed the script.
bramley is offline   Reply With Quote
Old 02-18-2005, 02:27 AM   #8
ibroughton
Guest
 
Posts: n/a
Just what I've been looking for. Simply changing the color of the text isn't good enough for me as I'm partially color blind, but having the background of the text changed makes it easy to distinguish! Odd that the "Other" selection causes it to crash, but hey, there's enough of a list of colors to be getting on with!
Many thanks!

Last edited by ibroughton; 02-18-2005 at 02:30 AM.
  Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:09 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.