Page 2 of 2

Re: Replacing list numbers with their values

Posted: 2012-07-09 14:06:43
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]".

Another macro

Posted: 2012-07-11 17:41:09
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