How to check if value of readonly property is using extendscript?

I am writing a script for After Effects that collects all properties from a layer and writes them to an XML file. When I retrieve values ​​from XML, some values ​​are read only if the toolbox causes an error.

Is there a way to check this as a readonly attribute of a File object? i.e.: layer.property (). (readonly || readOnly)

If not, can someone tell me which aproach I can go with in order to go in the right direction?

+6
source share
3 answers

Given that the first element in the project is comp with hardness in it, this works, but maybe it is kludgey, and for this you will need to build (every) line to do this - but maybe you are already set up for this :

var r; r = testForReadability("app.project.items[1].layers[1].enabled"); alert(r); r = testForReadability("app.project.items[1].layers[1].width");//a solid width is NOT writable alert(r); function testForReadability(thisProperty) { var x; try { x = eval(thisProperty); eval(thisProperty + " = x;"); return true; } catch(e) { return false; } } 

Nevertheless, a small bank of worms opens in which “false” ones will not work if the option “Enable Script debugger” is set. Therefore, you need to make a workaround to check this parameter and temporarily reset it (see http://aenhancers.com/viewtopic.php?f=8&t=189&p=554&hilit=debugger#p554 )

+3
source

I do not think you can get this information from ESTK.

You can use the Post-Effects Scripting Guide to test and create an object that contains all the readonly properties, and then check to see if this object includes this property.

Here's a link for a scripting guide: After-Effects-CS6-Scripting-Guide

+2
source

Just try overriding it and returning it back, for example:

 isReadOnly("platform", navigator) // true, navigator.platform is read only isReadOnly("parent", window) // false, window.parent is not read only function isReadOnly(value, container){ var tmp = container[value]; var tmp2; var coolString = "cool"; container[value] = "cool"; tmp2 = container[value]; container[value] = tmp; return coolString != tmp2; } 
0
source

All Articles