Re: Q: specifying text in a variable to a color when inserting into Apple's Mail.app?
Re: Q: specifying text in a variable to a color when inserting into Apple's Mail.app?
- Subject: Re: Q: specifying text in a variable to a color when inserting into Apple's Mail.app?
- From: cricket <email@hidden>
- Date: Fri, 14 Feb 2003 13:20:47 -0800
Scripting the text content is part of the Cocoa text suite. To use it
in Mail, you could write something like this:
tell application "Mail"
tell content of outgoing message 1
set the RGB_value to {65536, 25000, 12}
set color of paragraph 1 to the RGB_value
end tell
end tell
The RGB values go from 0 to 65536. RGB_value is a special parameter
(for reasons I don't quite understand, so be sure to follow the syntax
I've described exactly.
To calculate the RGB values, you could find a color in the Color Panel
in the RGB sliders section and convert from their 0 - 255 scale to the
scripting scale of 0 - 65536. Just multiply what the color panel says
by 65536, then divide by 255.
- cricket
On Thursday, February 13, 2003, at 19:19PM, Marc S.A. Glasgow wrote:
Greeting fellow listers,
yes, I've been quite (but lurking) for quite some time. I've
written a script to grab some inbound information from UPS tracking
updates and remail just the relevant data to my clients who are
expecting the packages. One thing I haven't licked yet is how to
specify that a specific paragraph of text be colored to something
other than the default (red instead of black).
Code segment in question:
-- the following line is for demonstration purposes only (the string
is actually 22
-- paragraphs long and contains 1500 characters or so):
set FormulatedLetterContents to "AA BB CC DD EE" & return & "FF GG HH"
-- time to create the new outbound message
set ShipNotice to make new outgoing message with properties [CON'T]
{sender:"<email@hidden>", reply to: [CON'T]
"email@hidden", visible:true}
tell ShipNotice to make new to recipient at end of to recipients
[CON'T]
with properties {address:OutboundRecipient}
set subject of ShipNotice to OutboundTitle as text
set content of ShipNotice to FormulatedLetterContents
-- ^^ Right here is the problem. Having composed ^^
-- FormulatedLetterContents from a number of different
-- information sources, I have effectively a very long text
-- string, and I'm placing it into the body of the letter. How
-- do I specify that I want paragraph 2 of the text to become
-- red? I tinkered on this for hours last night, but was
-- unable to lick it. Couldn't even figure out if the color
-- reference was in RRGGBB or by name or by some other
-- color space.
Any help appreciated.
=-= Marc S.A. Glasgow
email@hidden
www.cyberpoet.net
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
... drag on the falling water drops creates a mini-hurricane, producing
a low-pressure 'eye' that attracts the shower curtain.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.