Half of the PS objects/functions are DOM objects and perfectly declared as interfaces, while the other half actually are used like classes and can be instantiated.
DOM objects can be filtered on their "parent" property. Just "MeasurementLog" and "MeasurementScale" do not have this property for some reason. "Application" and "UnitValue" are special cases anyway. These exceptions are respected in the renderer (kind of hardcoded...). Let me know what you think about it.
The other part of functions will now be declared as classes. They do not have explicit parameters in their constructors (nor are they documented), but Extendscript wants them to be specified like this:
var myColor = new SolidColor()
myColor.rgb.blue = 50
myColor.rgb.green = 40
myColor.rgb.red = 90
There's a separate file in the assets now that documents what's a DOM object or a class for any possible future use.
Finally a minor fix in the assets about arrays of 2D point coordinates (should be number[][], documentation says just number[]). Example:
let A = [0, 0];
let B = [50, 0];
let C = [50, 50];
let D = [0, 50];
let square = [A, B, C, D];
app.activeDocument.selection.select(square);
Half of the PS objects/functions are DOM objects and perfectly declared as interfaces, while the other half actually are used like classes and can be instantiated.
DOM objects can be filtered on their "parent" property. Just "MeasurementLog" and "MeasurementScale" do not have this property for some reason. "Application" and "UnitValue" are special cases anyway. These exceptions are respected in the renderer (kind of hardcoded...). Let me know what you think about it.
The other part of functions will now be declared as classes. They do not have explicit parameters in their constructors (nor are they documented), but Extendscript wants them to be specified like this:
There's a separate file in the assets now that documents what's a DOM object or a class for any possible future use.
Finally a minor fix in the assets about arrays of 2D point coordinates (should be number[][], documentation says just number[]). Example: