Apply color attributes

Get help using and writing Nisus Writer Pro macros.
Post Reply
Pat
Posts: 28
Joined: 2009-09-04 13:11:25

Apply color attributes

Post by Pat » 2009-09-04 13:33:02

Hi,

I don't know anything about macros and programming. I'm trying to do a very simple macro: find all 'a' letters and give them different attributes (font, color, style, etc). Now I'm trying to find how to apply a color attribute that is not in the menu (for example, FFCC33). I tried many things that did'nt work including the command "Set text color":

Find all 'a', '-i',
Bold
Set Font Name "Verdana"
Set Text Color "FFCC33"

User avatar
martin
Official Nisus Person
Posts: 4273
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Apply color attributes

Post by martin » 2009-09-04 15:52:27

The "Set Text Color" command only accepts a Color object, not a string. There are many ways to get Color objects (see the macro reference), but this probably fits what you've described best:

Code: Select all

$color = Color.newWithHexTriplet 'FFCC33'
Set Text Color $color
Let me know if you have any more questions.

Pat
Posts: 28
Joined: 2009-09-04 13:11:25

Re: Apply color attributes

Post by Pat » 2009-09-05 16:46:01

Thanks. That's exactly what I wanted to do.
Last edited by Pat on 2009-09-08 05:37:32, edited 1 time in total.

Post Reply