Page 1 of 1


Posted: 2009-04-02 04:01:24
by fbloom
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 =
$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?

Re: .firstLineHeadIndent

Posted: 2009-04-02 05:00:03
by Kino
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.