Hi,
Let assume that you have created a doc with proper number of pages (with textFrames placed and sized ),
which you have discovered already, I guess.
Let assume that those textFrames are not threated (linked).
Let assume that each "interior" page is applied to a specific masterSpread (let say "B").
To connect textFrames in your way - you could run this code:
// assummes that interior pages are applied to a specific masterSpread // (here it is a 2nd masterSpread ==> modify this if need) // assumes that interior startPageNumber and endPageNumber is set var mDoc = app.activeDocument, interiorMasterSpread = mDoc.masterSpreads[1], startPage = 3, endPage = 10, pageSum = endPage + startPage, pageCnt = endPage - startPage + 1, mInterior = [], mFrames = [], lowFrameNum, highFrameNum, currSpread, jumper, currFrame, prevFrame; //fill an array with interior pages for (var k = 0; k < mDoc.pages.length; k++) if (mDoc.pages[k].appliedMaster == interiorMasterSpread) mInterior.push(mDoc.pages[k]); // check if count of pages, their numbers and order is correct if (endPage <= startPage || pageSum % 2 == 0 || mInterior.length !=pageCnt) { alert ("Something wrong with pages"); exit(); } // assummes each page has one textFrame correctly sized and placed // each textFrame is named as algorythm says (there is a space up to 999 pages) // fill an array with textFrames names for (var k = 0; k < mInterior.length; k=k+2) { jumper = (k/2)%2; // jumps between values 0 and 1 lowFrameNum = startPage + k/2; highFrameNum = pageSum - lowFrameNum; currSpread = mInterior[k].parent; // page[0] or page[1] currSpread.pages[jumper].textFrames[0].name = ("00" + lowFrameNum).slice(-3); // i.e "003" mFrames.push (currSpread.pages[jumper].textFrames[0].name); // page[1] or page[0] currSpread.pages[Math.abs(jumper-1)].textFrames[0].name = ("00" + highFrameNum).slice(-3); // i.e. "010" mFrames.push (currSpread.pages[Math.abs(jumper-1)].textFrames[0].name); } mFrames.sort(); // sort ascending means proper order for linking // textFrames location is correct, // textFrames order in thread goes as an array order for (k = 1; k < mFrames.length; k++) { currFrame = mDoc.textFrames.item(mFrames[k]); prevFrame = mDoc.textFrames.item(mFrames[k-1]); currFrame.previousTextFrame = prevFrame; }
Jarek