Copy link to clipboard
Copied
Hi.
This is a simple one, I am trying to apply an already made Object Style to a text frame.
I am using a similar method as used to apply a paragraph style:
myFrame.appliedObjectStyle.name= "GreenBox";
and alsomyFrame.appliedObjectStyle= "GreenBox";
But these dont work.
I have researched the forums and found something like:
myFrame.applyObjectStyles(GreenBox , true);
and
myFrame.applyObjectStyles(GreenBox);
but these dont work either.
Can someone give me a hand with the correct syntax please?
Thanks in advance
Roy
Copy link to clipboard
Copied
Roy Marshall wrote:
I have researched the forums and found something like:
myFrame.applyObjectStyles(GreenBox , true);
and
myFrame.applyObjectStyles(GreenBox);
but these dont work either.
the problem is in S after applyObjectStyle ... should be applyObjectStyle - without S at end
robin
www.adobescripts.co.uk
Copy link to clipboard
Copied
I have just answered this by finding another thread...
myFrame.applyObjectStyle(app.documents[0].objectStyles.item("GreenBox"), true);
Copy link to clipboard
Copied
void applyObjectStyle (using: ObjectStyle[, clearingOverrides: bool=true][, clearingOverridesThroughRootObjectStyle: bool=false])
Applies the specified object style.
| Parameter | Type | Description |
|---|---|---|
| using | ObjectStyle | The object style to apply. |
| clearingOverrides | bool | If true, clears the Button's existing attributes before applying the style. (Optional) (default: true) (Optional) |
| clearingOverridesThroughRootObjectStyle | bool | If true, clears attributes and formatting applied to the Button that are not defined in the object style. (Optional) (default: false) (Optional) |
-- so you can use one or even two trues; it's default is 'true'.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more