Hi jb. That's clever! Just use Nisus built in default output for the Comment object.
Here is a slightly modified version of your macro, that directly gives you the list without needing to use Find/Replace to clean it up.

Thanks, Philip.
Of course I was thinking of you when I mentioned the macro guru, but it's been five years (!).
I'm traveling now so can't try out your improved version.
Will do so next week when I'm back in town and thank you properly then.

I wondered why $listDoc = is in the final line
$listDoc = Document.newWithText $commentList.join("\n")

Of course it was in the macro I put up recently, but I didn’t really understand it. It came along for the ride when I copied/pasted from another, earlier macro.

Then I deleted the part that mystified me ( $listDoc =), and I discovered that it isn’t necessary.
My guess now is that it was used to do two things at once: to create a new Document and also to define that new document as a named object. And since I don’t need to do anything more than create the new document whose text is the list, I’ve just deleted that part of the last line.

I need to read a bit in the Macro Reference Guide to understand arrayByMakingValuesDoCommand

I wondered why $listDoc = is in the final line
$listDoc = Document.newWithText $commentList.join("\n")
…
Then I deleted the part that mystified me ( $listDoc =), and I discovered that it isn’t necessary.
My guess now is that it was used to do two things at once: to create a new Document and also to define that new document as a named object. And since I don’t need to do anything more than create the new document whose text is the list, I’ve just deleted that part of the last line.

That is exactly how it is.

I need to read a bit in the Macro Reference Guide to understand arrayByMakingValuesDoCommand

The arrayByMakingValuesDoCommand command (that's quite a mouthful ) is a bit of macro magic that takes one array and creates a second array of the exact same size by applying a command to each value in the first array. Since the $doc.allComments is an array of Comment objects, but we only want the text of the comments, we apply the text command (ok, technically it's a property, not a command, but whatever…) to each object in the array and get an array of texts. So this one command is equivalent to writing a loop code. Something like this:

I think the name of the command is supposed to come out as something like "create a (new) array by making the values of the array do the command" and then the name of the command to do follows as an argument.

In short: arrayByMakingValuesDoCommand is "Map" in other languages. I wonder: is there an equivalent to "Filter" and "Reduce?"

I see. So JavaScript has this kind of thing.

Nisus arrayByMakingValuesDoCommand is a bit more limited than map, since you can only use it for maps of arrays of objects using properties/commands that apply to that object. For example you can take an array of selections and get their lengths, but you couldn't extend all the selections by n characters, since the selection object does not have a an "extend by n characters" command.
And if you have an array of number values you can't use arrayByMakingValuesDoCommand at all, since number values are not objects.

And there is nothing like "Filter" or "Reduce". But you can always write defined commands for doing things like that.

In the end Nisus macro language is tailored for the tasks you will most likely need as a (text) document creator. And if you need more technical stuff you can always insert a Perl block.

Hmm. That's a subtle quirk there Philip. The Macro language guide, under the "Call" section, explains how to build a proper "Map" command, though you apparently have to hand build the function. You can no doubt do "filter" and "Reduce" the same way. I wish it was built in, though.

The macro language is a curious combination of functional and object oriented.