Reply to topic  [ 2 posts ] 
Author Message

Joined: 2009-03-29 15:34:30
Posts: 10
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?

2009-04-02 04:01:24

Joined: 2008-05-17 04:02:32
Posts: 400
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.

2009-04-02 05:00:03
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software