Skip to main content
dublove
Legend
Jun 15, 2026 2:44 PM UTC
Answered

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

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?

    rob day
    rob dayCorrect answer
    Community Expert
    Jun 15, 2026 6:51 PM UTC

    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}

     

    13 replies

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    Jun 15, 2026 6:51 PM UTC

    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}

     

    Translate
    dublove
    dubloveAuthor
    Legend
    Jul 20, 2026 11:07 AM UTC

    Hi ​@rob day 

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

    textFramePreferences: { insetSpacing: [2.5 * 2.834645, 0, 0, 0] },

    insetSpacing: [2.5 * 2.834645, 0, 0, 0],

     

    This is also incorrect.
    Not reporting an error does not necessarily mean it is working.

    It seems necessary to write it outside.
    Only this is correct

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

     

    Translate
    Community Expert
    Jun 15, 2026 3:29 PM UTC
    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

    Translate
    -Manan
    dublove
    dubloveAuthor
    Legend
    Jun 15, 2026 4:18 PM UTC

    ​@Manan Joshi 

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

    Translate
    Community Expert
    Jun 16, 2026 3:41 AM UTC

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

    Translate
    -Manan
    Community Expert
    Jun 15, 2026 3:00 PM UTC

    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]
    };

     

    Translate
    dublove
    dubloveAuthor
    Legend
    Jun 15, 2026 3:16 PM UTC

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

    Translate
    Community Expert
    Jun 15, 2026 3:21 PM UTC

    Told you that the 2nd one was probably better.

    Translate
    Community Expert
    Jun 15, 2026 2:56 PM UTC

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

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

    }

     

    Translate
    -Manan
    dublove
    dubloveAuthor
    Legend
    Jun 15, 2026 3:05 PM UTC

     

    ​@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,

     

    Translate
    Community Expert
    Jun 15, 2026 3:24 PM UTC

    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.

    Translate