Copy link to clipboard
Copied
I'm looking for a method that's similar to Python's dir(x) which lists all the properties of an object. I'm looking to use this on After Effects Objects.
You can use a for...in loop: for (var key in myObj) if (myObj.hasOwnProperty(key)){ ...}
But in ExtendScript there are also Reflection and ReflectionInfo objects. Those are not documented in the After Effects Scripting Guide but in the JavaScript Tools Guide (common to all Adobe scriptable apps).
For any ExtendScript object o you can query its reflection object. o.reflect is an object with properties and methods:
Copy link to clipboard
Copied
You can use a for...in loop: for (var key in myObj) if (myObj.hasOwnProperty(key)){ ...}
But in ExtendScript there are also Reflection and ReflectionInfo objects. Those are not documented in the After Effects Scripting Guide but in the JavaScript Tools Guide (common to all Adobe scriptable apps).
For any ExtendScript object o you can query its reflection object. o.reflect is an object with properties and methods:
For what a ReflectionInfo looks like, see the JavaScript Tools Guide. (The main properties are "name", "dataType", "type")
For instance, if o is a layer position property:
o.reflect.methods = array of ReflectionInfo corresponding to all "ADBE Position" methods
o.reflect.find("setValue") => ReflectionInfo corresponding to the method "setValue"
o.reflect.find("setValue").name : "setValue"
o.reflect.find("setValue").arguments.length : 0 // SHOULD BE 1 ... arguments are not filled in 😞
Xavier.
Copy link to clipboard
Copied
Thank you
Copy link to clipboard
Copied
You should accept the answer
Find more inspiration, events, and resources on the new Adobe Community
Explore Now