Replacing list numbers with their values

Everything related to our flagship word processor.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Replacing list numbers with their values

Post by martin »

Great David, thanks for posting your final macro- it looks good to me.
# 1) Menu State “:Format:Lists:$targetStyle.name” did not work
# assigning $targetStyle.name to variable and using in Menu State did
That's because the macro language only does basic variable interpolation inside double-quote marks. That means replacing "$targetStyle" with its current value, but not anything more complicated like "$targetStyle.name" or "$styles[3]".
Bob Stern
Posts: 170
Joined: 2006-03-12 12:32:47

Another macro

Post by Bob Stern »

The following macro is based on a different approach recommended by Martin two years ago:
http://nisus.com/forum/viewtopic.php?f=18&t=3921

Note that Step 1 (Convert to Fixed Content) preserves the current selection, but I don’t know how to limit Step 2 to the current selection. Perhaps Martin can help.

Code: Select all

#  1. Convert all Cross-References (dependent claims) to plain text:
Select All
Menu ‘:Tools:Automatic Content:Convert to Fixed Content’

#  2. Convert all list numbers (list bullets) to plain text:
# Go backwards from end of document so numbering doesn't change as we progress.
Select Document End
While Select Previous List Item    # “Previous” goes backwards.
	$selection = TextSelection.active
	$bullet = $selection.substring

	# Prevents list numbering from being re-created by paragraph style:
	Menu ':Format:Lists:Use None'
	Write Selection $bullet
End
Post Reply