Skip to main content
dublove
Legend
Aug 12, 2025 4:57 AM UTC
Answered

How to add some setting for the AA objectStyle?

I can't find the size settings.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#ObjectStyle.html

 

//Creat AA ObjectStyle
var wn = [AA];
for (var i = 0; i < wn.length; i++) {
    w = newObjStyle(app.activeDocument, wn[i], emptyStyle);
};

 

I want to set image size, frame,
fit content proportionally, position objects,  wrap text in the script.
Like this:

 

 

dublove
dubloveCorrect answer
Legend
Aug 15, 2025 5:43 PM UTC

Hi @Manan Joshi 

Hi @rob day 

I searched for a long time and found that:
There is very little information on setting the width in object styles.
For example, I want to set the width of the “AA” object style to 42 mm.

 

25 replies

rob day
Community Expert
Community Expert
Aug 12, 2025 1:11 PM UTC

What is [AA]? var wn = [AA]; throws an error:

 

 

If it’s supposed to be an object style then it needs to be this:

 

var wn = app.activeDocument.objectStyles.itemByName("AA")
 
And if it is an object style there is nothing to loop thru object styles have no length property:
 
Translate
dublove
dubloveAuthor
Legend
Aug 12, 2025 2:19 PM UTC

Hi rob day.

Sorry, it should be “AA.”

The original AA was read from my.json.
emptyStyle, refer to the information provided by m1b.
https://community.adobe.com/t5/indesign-discussions/how-to-create-new-object-styles-based-on-really-quot-none-quot-object-using-scripts/m-p/15412503

Translate
rob day
Community Expert
Community Expert
Aug 12, 2025 2:39 PM UTC

Sorry, it should be “AA.”

 

That also throws an error—wn[i] returns the character A

 

Translate
Community Expert
Aug 12, 2025 10:32 AM UTC

If possible please do post screenshots in english as many of us can't read the language you post. Secondly you explain it in very few words so really difficult. However, I checked and maybe look into methods like setPositionAttributeState and setDimensionAttributeState

-Manan

Translate
-Manan
brian_p_dts
Community Expert
Community Expert
Aug 12, 2025 3:38 PM UTC

And your fit content proportionally options are under the frameFittingOptions property. Actually study and test against thr API. 

Translate