I am trying to write a script to perform a data merge, followed by a find/replace, page add, and finally export. I can get it to perform the merge and find/replaces that are needed.
When I add a new page manually I normally select the first page in the pages window then click add a new page at the bottom. Doing that makes every page after that go to 2 pages(like an open book). I don't know how to do this in the script, what I tried below didn't work. It adds a new page at the end of the document and that page is the active one on screen.
app.activeDocument.pages.item(0).select();
app.activeDocument.pages.add();
After the merge, editing gets really slow, taking 15-20 per letter I add or delete.The only way i've found to have it edit like you'd expect is by exporting it to the IDML format then reopening that file in InDesign. I haven't been able to find much on exporting via a script. I've seen exports similar to:
app.activeDocument.exportFile(ExportFormat.INDESIGN_MARKUP, newDoc, false);
But I don't know if that will work or not.
I'm very new to scripting in InDesign. I'm using InDesign CS5.5.