add property to object

479 Views Asked by At

With Indesign scripting, why can't I add properties to an object? I get an error

Object does not support the property or method 'foo'

items = b.items(b.layer("s_labels"));

for (var i = 0; i < items.length; i++) {
    items[i].fit(FitOptions.frameToContent);

    items[i].foo = "bar";
    // other attempt
    items[i]["foo"] = "bar";
}
1

There are 1 best solutions below

2
On

I guess you simply are not allowed to add new fields or methods to javascript objects that are provided by InDesign.