Copy link to clipboard
Copied
Hi All,
I have trying to add and change the master page's textFrame to primaryTextFrame as below, but can't change to Primary Text Frame. Kindly guide to me.
Kindly suggest if any alternate method.
var myDoc = app.documents.item(0);
myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
myDoc.zeroPoint = [0, 0];
var m = myDoc.pages[0].marginPreferences;
var marT = m.top-1;
var marL = m.left-1;
var marB = (myDoc.documentPreferences.pageHeight - m.bottom)-1;
var marR = (myDoc.documentPreferences.pageWidth - m.right)-1;
var gbounds = [m.top, m.left, myDoc.documentPreferences.pageHeight - m.bottom, myDoc.documentPreferences.pageWidth - m.right];
var myDoc = app.activeDocument;
var myMaster = myDoc.masterSpreads;
for(m = 0; m<myMaster.length; m++){
if(myMaster
myMaster
myMaster
var myT = myMaster
for(g=0; g<myT.length; g++){
var T0 = Math.round(myT
var T1 = Math.round(myT
var T2 = Math.round(myT
var T3 = Math.round(myT
if((T0>marT)&&(T1>marL)&&(T2>marB)&&(T3>marR)){
if(myT
//~ myT
//~ alert(T0+" - "+T1+" - "+T2+" - "+T3+"\r"+marT+" - "+marL+" - "+marB+" - "+marR);}
//~ if(myT
}
}
}
}
Thanks,
Selva
Hi Selva,
FWIW:
A solution not for InDesign Server
1. Select a text frame on the master spread.
2. Run a menuAction to transform a text frame to a primary text frame.
Lookup the menuAction's name from the context menu after you selected a text frame on a master spread.
Warning! I tried exactly that, but it crashed my InDesign severely.
… ( some minutes later : ) …
Ah. I think I can tell why my InDesign was crashing:
In the moment I was invoking the menu action the master spread was not the active spread.
...Copy link to clipboard
Copied
Hi Selva,
FWIW:
A solution not for InDesign Server
1. Select a text frame on the master spread.
2. Run a menuAction to transform a text frame to a primary text frame.
Lookup the menuAction's name from the context menu after you selected a text frame on a master spread.
Warning! I tried exactly that, but it crashed my InDesign severely.
… ( some minutes later : ) …
Ah. I think I can tell why my InDesign was crashing:
In the moment I was invoking the menu action the master spread was not the active spread.
So make sure that the master spread is the active spread!
Other suggestion that is working:
Add a new document where you define a primary text frame.
Duplicate the master spread to your document where you need the primary text frame.
Use the duplicated master spread instead of the one you already have.
( Tested with InDesign CS6 8.1.0 on OSX 10.10.5. )
Regards,
Uwe
Copy link to clipboard
Copied
Hi Uwe,
Thanks for the suggestion, i did with menuAction method (invoke).
myT
app.menuActions.item("Primary Text Frame").invoke();
Thank you so much this,
Selva.
Copy link to clipboard
Copied
Hi Selva,
I hope that you are spared from crashes.
Just another comment on the problem:
DOM documentation is suggesting—at least I do interpret it this way—that one should be able to assign a pageItem ( text frame or text path ) as value to property masterSpread.primaryTextFrame . However, this is not working. It is always throwing an error. The documentation is showing that this property is r/w . Maybe other factors must be in order that this would work, but they are not mentioned.
I also tried to set the preferences of the document in advance, but this seems to be not sufficient:
doc.documentPreferences.createPrimaryTextFrame = true;
For all scripters working with or for locale versions of InDesign, the string for the menu action that should work on all desktop versions of InDesign—e.g. my German version—is:
"$ID/kPrimaryTextFrameMenuItem"
Best,
Uwe
Copy link to clipboard
Copied
How do I check this property (Primary Text Frame) already enabled in the master page.
Copy link to clipboard
Copied
Hi,
check the value of property primaryTextFrame of masterSpread.
You get null if there is no primary text frame. You get a text frame if there is a primary text frame.
Then you could ask for parentPage of the returned text frame.
If you get null the primary text frame is on the pasteboard. If not a page object is returned.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Thanks for this.