Well, pagination is this thing. Nisus needs to calculate the page layout. And before you include pages in a document so Nisus can do that, there won't actually be any pages. As the macro language documentation says, for new text objects like the one you are working with, you will just get undefined
as the answer.
Your best bet would be to write a separate macro, that you could run after you have joined the files and created the document. I'm assuming that you already are setting the relevant headings to always start a new page, and that what you are looking for is something that will insert a blank page every time such a heading is on an even page.
That macro would look something like this:
Code: Select all
$doc = Document.active
$headingStyle = $doc.styleWithName ("Heading 1")
while Find($headingStyle, "-W")
$sel = TextSelection.active
$pageNum = $doc.text.pageNumberAtIndex $sel.location
if ($pageNum % 2) == 0
$doc.text.insertAtIndex $sel.location, "\x0C\n"
I have given this only a cursory test.