create object style based on another object style
Copy link to clipboard
Copied
In scripting when I create a new object style based on another object style the result is the new object style don't match with the properties of the based on object style.
Is it possible to reset all properties to the based on object style properties obviously with script?
Copy link to clipboard
Copied
Can you show your code?
Copy link to clipboard
Copied
I'm using apple script but you can answer also with java
the simple code is:
tell application "Adobe InDesign CC 2018"
set DOC to document 1
tell DOC
tell object style group "FIGURE"
make object style with properties {name:"NewStyle", based on:object style "FIG-L---D"}
end tell
end tell
end tell
Copy link to clipboard
Copied
I think you have to explicitly specify the attributes of each object style you create, as well specifying which styles are based on another style. Then changes to a basic object style will propagate to any object styles based on it. For example, using JavaScript, the inset spacing and paragraph style of the second style below (myObjectStyleO) change automatically when changes are made to the first style (myBasicObjectStyle):
myBasicObjectStyle = myDocument.objectStyles.add({name:"Red", fillColor:"RD", gradientFillAngle:0, strokeWeight:0, enableParagraphStyle:true, appliedParagraphStyle:"Numbers", enableTextFrameGeneralOptions:true});
myBasicObjectStyle.textFramePreferences.insetSpacing = [1,0,0,0];
myObjectStyleO = myDocument.objectStyles.add({name:"Orange", basedOn:myBasicObjectStyle, fillColor:"OD", gradientFillAngle:0, strokeWeight:0, enableParagraphStyle:true, appliedParagraphStyle:"Numbers", enableTextFrameGeneralOptions:true});
myObjectStyleO.textFramePreferences.insetSpacing = [1,0,0,0];

