Hi
I need help with my code. I created a new text box and I would like to apply an object style to this text box. Note that object style and paragraph styles are already default in Indesign.
I did several tests but it does not work
————
Code:
//New Text Frame
myFrame=newDoc.textFrames.add(newDoc.layers.item(“Slug”));
myFrame.contents = K + ” ” + G + (“\r”) + H ;
myFrame.geometricBounds = [-5,0,0,D]; ////Top, Left, Bottom, Right
//OK for now
//To apply Object Style,
//I have tried this:
//var myObjectStyle = “Slug”;
//myFrame.applyObjectStyle(newDoc.objectStyles.item(myObjectStyle));
//I have tried this:
//myFrame.applyObjectStyle(myObjectStyle, true);
//and many more
————
Or is it possible to apply an Object Style according to the label name?
myFrame.label = “SlugTx”;
————
I have a pdf with examples of scripts but this seems to be only for Indesign CS6 and I’m working with 2015. So I’m not sure about which object model I should use.
If you have the solution ca would be greatly appreciated
Thanks
Kathy