Page 1 of 1
Loop through open documents
Posted: 2022-11-04 01:58:29
by tedg
I have a nice macro that sets various view parameters of an open document. How do I apply that to all open documents?
Things like no pallets, window size and position, typewriter scrolling. Nothing in the doc content.
TiA, Ted
Re: Loop through open documents
Posted: 2022-11-04 02:46:12
by adryan
G'day, Ted et al
Regular visitors will know that I have only rudimentary knowledge of the Nisus Macro Language, but I felt sure the answer would lie in at least one of the supplied Macros. And indeed there is a snippet of code for looping through all open documents in the Macro titled "Save All Documents" in the Document set of Macros that you may find helpful. It uses the Document Type Command "Document.openDocuments". It is also used in the Macro titled "Sort Open Document Windows" in the same location, so you know it must be good.
Cheers,
Adrian
Re: Loop through open documents
Posted: 2022-11-04 02:53:52
by tedg
Fantastic. Thanks
Re: Loop through open documents
Posted: 2022-11-05 05:07:47
by phspaelti
As Adrian says
Document.openDocuments should work. The following code will apply
My Fantastic Macro to all open documents.
Code: Select all
foreach $doc in Document.openDocuments
Document.setActive $doc
My Fantastic Macro
end