Legend
July 20, 2026
Question
Reset to Base still hasn't really solved it?
- July 20, 2026
- 1 reply
- 37 views
Hi everyone.
Is there no corresponding code for the Reset to Base option?
There is no information in the script manual, and only I have asked about the relevant content in the forum.
For example, the basic style is A, but after running, B is not completely based on A
Originally,
Pay attention to the changes in the style of object B, which was originally based on "TrueNone".
In fact, every time based on it, it needs to be reset to the bese. But the relevant code is missing for some unknown reason.
var A = app.documents[0].objectStyles.itemByName('A');
var B = app.documents[0].objectStyles.itemByName('B');
B.basedOn = A;
resetObjectStyle(B);
function resetObjectStyle(style) {
var baseStyle = style.basedOn;
var oldName = style.name;
if (!baseStyle.isValid) {
return alert('Object style cannot be reset due to missing base style.');
exit();
}
style.properties = baseStyle.properties;
style.name = oldName;
style.contentEffectsEnablingSettings.properties = baseStyle.contentEffectsEnablingSettings.properties;
style.objectEffectsEnablingSettings.properties = baseStyle.objectEffectsEnablingSettings.properties;
style.basedOn = baseStyle;
}



