Reply to topic  [ 4 posts ] 
How to apply color properties 
Author Message
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
Sorry to bother, but the Macro Reference is a little light on examples and I'm not a programmer. If I have a variable $value and I want to make all the text in that variable black, how to I apply the Color.black command.

Thank you
Lou


2009-06-01 03:02:48
Profile WWW
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
The Color.black command is a command which returns a constant. The result is a rgb value (0,0,0). You can use this in commands like the "Set Text Color" command. That command assigns the color value to the current selection.

In your case, I am guessing, the $value is not the current selection, but maybe a variable that you have created? Ideally one could set the attribute properties of such a variable directly, but the way I understand the manual, attribute properties are read only at the current time. So you will probably have to set the color at the time when you want to insert into your file.

philip

_________________
philip


2009-06-01 05:10:51
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
Well, attributes objects are read-only. As a workaround, you can convert $value (styled text) into RTF data, replace all colour definitions in the colour table with that of black, and convert the data into styled text again:
Code:
$value = Encode RTF $value
$value = Cast to String $value
$value.replaceAll '(?<=;)\x5Cred\d+ \x5Cgreen\d+ \x5Cblue\d+(?= ;)', '\x5Cred0 \x5Cgreen0 \x5Cblue0', 'E-i'
$value = Decode RTF $value


2009-06-01 07:28:19
Profile
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
Thank you all for your replies. After some tooling around, my solution distilled down to some very simple steps which uses the :Format:Text Color command.

Lou


2009-06-04 08:06:15
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software