Get help using and writing Nisus Writer Pro macros.
Post Reply
Posts: 10
Joined: 2009-03-29 15:34:30


Post by fbloom » 2009-04-02 04:01:24

I am trying to write a macro that will cause the paragraph to indent 1/2 inch at the location of the cursor. I have written the following code and I am getting the message:

"You cannot change the "firstLineHeadIndent" property of the Attributes object."

$doc = Document.active
$selection = $doc.textSelection
$text = $doc.text
$index = $text.length -1
$attributes = $text.attributesAtIndex $index
$points = $attributes.firstLineHeadIndent
$points += 36
$attributes.firstLineHeadIndent = $points

Can someone tell me what I am doing wrong?

Posts: 400
Joined: 2008-05-17 04:02:32

Re: .firstLineHeadIndent

Post by Kino » 2009-04-02 05:00:03

No, you are doing nothing wrong. Unfortunately this property as well as all the other attributes object properties are read-only as described in Nisus Macro Reference.rtf. You cannot change it. What the current Nisus Writer Pro macro enables us to do is, for example, to create a new paragraph style with a longer firstLineHeadIndent and apply it on the insertion point. Or to apply "Format:Increase Indent" or to insert some blank characters (tab, no-break space, etc.) at the paragraph start... or yet another thing, maybe.

In your macro, there is something I don't understand well. If you want to get the attributes of the insertion point, I think "$index = $text.length -1" should be "$index = $selection.location" and perhaps you'd better use ".displayAttributesAtIndex" instead of ".attributesAtIndex" which, the latter, returns undefined for attributes not manually applied but defined in character/paragraph styles.

Post Reply