Skip to main content
Lordrhavin
Inspiring
June 9, 2026
Question

enum undefined

  • June 9, 2026
  • 3 replies
  • 43 views
    var productFrame = app.activeDocument.textFrames.add();
productFrame.properties =
{
strokeWidth : 0,
fillColor : "None",
contents : "!",
flexItemHeightMode: FlexWidthHeightMode.FLEX_FILL
};

I get the error that “FlexWidthHeightMode is not defined”
What am I missing?

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

    3 replies

    Legend
    June 10, 2026

    Could be that you are using

    • a versioned script (check app.scriptPreferences.version ?)
    • an old version (pre 21.0) that does not yet support flex
    • UXP / UXPSCRIPT without populating the enum from the require()

    @Mike Witherell FlexEnum only has FLEX_AUTO.

    Mike Witherell
    Community Expert
    Community Expert
    June 9, 2026

    What happens if you change this line?

    flexItemHeightMode: FlexWidthHeightMode.FLEX_FILL

    changes to 

    flexItemHeightMode: FlexEnum.FLEX_FILL

    Mike Witherell
    Peter Kahrel
    Community Expert
    Community Expert
    June 9, 2026

    Your code works fine over here on Windows 11 Pro and ID 2026 21.4.

    rob day
    Community Expert
    Community Expert
    June 9, 2026

    Hi ​@Peter Kahrel , I’m getting the error on MacOS with InDesign 2025 (20.5.1)

     

    var pf = app.activeDocument.textFrames.add();
    try {
    pf.flexItemHeightMode = FlexWidthHeightMode.FLEX_FILL;
    }catch(e) {
    alert(e)
    }

     

     

    Peter Kahrel
    Community Expert
    Community Expert
    June 9, 2026

    Looks like a Mac problem then.