Skip to main content
dublove
Legend
June 15, 2026
Answered

Can the “Inset Spacing” setting in the object style be written in the `properties` object?

  • June 15, 2026
  • 4 replies
  • 46 views

Right now, I can only write it like this:

var objPath = app.documents[0].objectStyleGroups.itemByName(ObjStyleGroup).objectStyles.itemByName(myObjStyle);
objPath.textFramePreferences.insetSpacing = [2.5 * 2.834645, 0, 0, 0]


But I want to write it in the `properties` section, like this:

objPath.properties = {
textFramePreferences.insetSpacing:[2.5 * 2.834645, 0, 0, 0]

}

But that seems to be wrong.
What should I do?

    Correct answer rob day

    But I want to write it in the `properties` section, like this:

     

    Also, you can’t use dot syntax inside the properties object. If I run your code with VSCode it throws an error and highlights the problems:

     

    @Eugene Tyson ’s code should work—this works for me where I’m setting properties, and nesting the textFramePreferences properties—VSCode doesn’t throw any errors on this line:

     

    objPath.properties = {strokeWeight:1, textFramePreferences: {insetSpacing: [2.5 * 2.834645, 0, 0, 0]}};

     

    When a property references an object with its own methods and properties (i.e., textFramePreferences) then this might be easier to read:

     

    //sets multiple properties of the object style object
    objPath.properties = {strokeWeight:1, strokeTint:50}
    //textFramePreferences is a separate object, so set its properties via objPath.textFramePreferences.properties
    objPath.textFramePreferences.properties = {insetSpacing:[2.5 * 2.834645, 0, 0, 0], columnRuleBottomInset:1, columnRuleOverprintOverride: true}

     

    4 replies

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    June 15, 2026

    But I want to write it in the `properties` section, like this:

     

    Also, you can’t use dot syntax inside the properties object. If I run your code with VSCode it throws an error and highlights the problems:

     

    @Eugene Tyson ’s code should work—this works for me where I’m setting properties, and nesting the textFramePreferences properties—VSCode doesn’t throw any errors on this line:

     

    objPath.properties = {strokeWeight:1, textFramePreferences: {insetSpacing: [2.5 * 2.834645, 0, 0, 0]}};

     

    When a property references an object with its own methods and properties (i.e., textFramePreferences) then this might be easier to read:

     

    //sets multiple properties of the object style object
    objPath.properties = {strokeWeight:1, strokeTint:50}
    //textFramePreferences is a separate object, so set its properties via objPath.textFramePreferences.properties
    objPath.textFramePreferences.properties = {insetSpacing:[2.5 * 2.834645, 0, 0, 0], columnRuleBottomInset:1, columnRuleOverprintOverride: true}

     

    Community Expert
    June 15, 2026
    app.documents[0].objectStyles.itemByName("obj").textFramePreferences.properties = {insetSpacing:[10,5,10,5]}

    worked for me. Even if the chain is on executing this code unchecked it and set the correct values

    -Manan
    dublove
    dubloveAuthor
    Legend
    June 15, 2026

    @Manan Joshi 

    I've used this before.
    That works.
    Now I want to write it inside objPath.properties{}

    Community Expert
    June 16, 2026

    properties is well a property so it has to be assigned which would need a = operator

    -Manan
    Community Expert
    June 15, 2026

    Yes, you can do it through properties, but textFramePreferences.insetSpacing cannot be written like that.

    Here I’d use a nested object:

    objPath.properties = {
        textFramePreferences: {
            insetSpacing: [2.5 * 2.834645, 0, 0, 0]
        }
    };


    This is probably better

    Set the properties of textFramePreferences directly:

    objPath.textFramePreferences.properties = {
        insetSpacing: [2.5 * 2.834645, 0, 0, 0]
    };

     

    dublove
    dubloveAuthor
    Legend
    June 15, 2026

    The first one doesn't work.
    I was using the second one before, and it works.

    Community Expert
    June 15, 2026

    Told you that the 2nd one was probably better.

    Community Expert
    June 15, 2026

    textFramePreferences is an object itself. So probably you can write something like

    objPath.textFramePreferences.properties = {
    insetSpacing:[2.5 * 2.834645, 0, 0, 0]

    }

     

    -Manan
    dublove
    dubloveAuthor
    Legend
    June 15, 2026

     

    @Manan Joshi 

    I tried that, but it didn't work.

    Do I need to unlock the “chain” in the middle?


    All the other settings worked. Like this one:
    enableTextFrameGeneralOptions: true,

     

    Community Expert
    June 15, 2026

    Try enabling the object-style category first, and then set the preference separately:

    objPath.properties = {
    enableTextFrameGeneralOptions: true
    };

    objPath.textFramePreferences.properties = {
    insetSpacing: ["2.5 mm", 0, 0, 0]
    };

    You should not need to unlock the chain separately. The scripting DOM does not expose that chain button as a separate property. Passing four different values should set independent insets in this order:

    [top, left, bottom, right]

    If the four inset fields remain linked or unavailable, check whether the object style applies rounded-corner settings, as InDesign can restrict individual inset values on rounded frames.