Hi there,
i've found this website http://hpcgi2.nifty.com/Nekomata/nekojy ... jectList01
in which there is a list of all objects/methods that can be used in a AE script.
i've noticed so many things that are not documented in the scripting guide, like the (app.) method "autoFixExpressions()" - but i don't know yet how to use it.
any ideas about these 'hidden features' ?
Japanese scripters are better informed
Moderator: Paul Tuersley
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
this method is now documented in the CS3 scripting guide...
Project autoFixExpressions() method
app.project.autoFixExpressions(oldText, newText)
Description
Automatically replaces text found in broken expressions in the project, if the new text causes the expression to
evaluate without errors.
Parameters
oldText The text to replace.
newText The new text.
My guess is the Japanese Site was using object introspection to grab the undocumented methods. The new Data Browser in Extendscript Toolkit 2 is also very good for object inspection.
Project autoFixExpressions() method
app.project.autoFixExpressions(oldText, newText)
Description
Automatically replaces text found in broken expressions in the project, if the new text causes the expression to
evaluate without errors.
Parameters
oldText The text to replace.
newText The new text.
My guess is the Japanese Site was using object introspection to grab the undocumented methods. The new Data Browser in Extendscript Toolkit 2 is also very good for object inspection.
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
Doing some research I ran across the reflection interface for ExtendScript
ExtendScript Reflection Interface
ExtendScript provides a reflection interface that allows you to find out everything about an object, including its name, a description, the expected data type for properties, the arguments and return value for methods, and any default values or limitations to the input values.
Reflection Object
Every object has a reflect property that returns a reflection object that reports the contents of the object. For example, you can show the values of all the properties of an object with code like this:
http://safari.ciscopress.com/032141294X/ch08lev1sec3
That should help in sussing out those undocumented methods
ExtendScript Reflection Interface
ExtendScript provides a reflection interface that allows you to find out everything about an object, including its name, a description, the expected data type for properties, the arguments and return value for methods, and any default values or limitations to the input values.
Reflection Object
Every object has a reflect property that returns a reflection object that reports the contents of the object. For example, you can show the values of all the properties of an object with code like this:
Code: Select all
var f= new File ("myfile");
var props = f.reflect.properties;
for (var i = 0; i < props.length; i++) {
$.writeln('this property ' + props[i].name + ' is ' +
f[props[i].name]);
}
That should help in sussing out those undocumented methods
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
what, are there no secrets anymore? i guess people haven't read up to p. 202 of the JavaScript Tools Guide for CS3 (formerly the Bridge JavaScript Reference). you know, that document that describes the File and Folder objects?bradshaw1965 wrote: http://safari.ciscopress.com/032141294X/ch08lev1sec3
That should help in sussing out those undocumented methods

:jeff
(deflated that he can no longer save this nugget for a future scripting book)
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
heh. Jeff. I was just responding to nab's original message about autoFixExpressions() and the Safari example happened to be the File object.
I do think a run down of how ExtendScript interacts with the AE DOM could be clearer in the documenation. I'm sure it's fully documented, but when you just want to "get things done" examples are more useful then straight docs. But I guess that's what your scripting book is about though, right? eagerly waiting...
I do think a run down of how ExtendScript interacts with the AE DOM could be clearer in the documenation. I'm sure it's fully documented, but when you just want to "get things done" examples are more useful then straight docs. But I guess that's what your scripting book is about though, right? eagerly waiting...
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
yeah, the docs could be clearer in identifying the parts of the shared ExtendScript stuff applies to After Effects.bradshaw1965 wrote:I do think a run down of how ExtendScript interacts with the AE DOM could be clearer in the documenation. I'm sure it's fully documented, but when you just want to "get things done" examples are more useful then straight docs. But I guess that's what your scripting book is about though, right? eagerly waiting...
yes, any After Effects scripting "book" (i'm still undecided on what form it'll take) i create will have both a reference section and lots of examples. i have a somewhat good idea of where i want to go with it, but just trying to find the free time to get there. :-/
:jeff
Hi guys,
I'm having trouble with autoFixExpressions, does it work for you ?
If I create a solid, add a slider control and write (for example) the following opacity expression:
and now execute this script:
nothing happens
( tried with numbers, same (non)result )
any suggestion ?
I'm having trouble with autoFixExpressions, does it work for you ?
If I create a solid, add a slider control and write (for example) the following opacity expression:
Code: Select all
effect("Slider Control")("xxx");
Code: Select all
app.project.autoFixExpressions("xxx", "Slider");
( tried with numbers, same (non)result )
any suggestion ?
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
hey nab,
I've had no luck with autoFixExpressions either, I can't even get it to bark at me with an error message or reveal much in the debugger. Just fails silently.
Dale
I've had no luck with autoFixExpressions either, I can't even get it to bark at me with an error message or reveal much in the debugger. Just fails silently.
Dale
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
i believe it works only when your script makes a change to a name (e.g., an effect name), and you want to fix expressions referring to it. i don't think it's intended to fix expressions previously "broken". i.e., it can't fix what it doesn't know about. you might need to do a search/replace for that stuff, and enable those expressions explicitly.nab wrote: I'm having trouble with autoFixExpressions, does it work for you ?
:jeff
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
Hey Jeff,redefinery wrote: i believe it works only when your script makes a change to a name (e.g., an effect name), and you want to fix expressions referring to it. i don't think it's intended to fix expressions previously "broken". i.e., it can't fix what it doesn't know about. you might need to do a search/replace for that stuff, and enable those expressions explicitly.
:jeff
Does the app object "know" about the broken expression dialog the user is provided with? I'm trying to get my head around how that state is represented internally.
Dale
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
hey dale,bradshaw1965 wrote:redefinery wrote: Does the app object "know" about the broken expression dialog the user is provided with? I'm trying to get my head around how that state is represented internally.
in what way are you referring to "know" -- that it keeps track of which expressions are broken, that it keeps track of how it's broken, or something else? i'm not sure, but i would think it knows in some form which ones are broken (because that's the state of the expression switch). as for how it's broken, maybe not...it might get re-evaluated each time (i think).
if you're trying to capture the text in the expression error dialog, i think you can just wrap your code with the begin/end suppress dialog methods (I don't have the docs in front of me, but search for "suppress").
or are you referring to something completely different?

:jeff
-
- Posts: 98
- Joined: March 14th, 2006, 2:16 pm
- Location: Atlanta, GA
- Contact:
Hey Jeff,
not sure yet. I can see a couple of different ways I might like to autoFixExpressions(). The first would be in the context of a try/catch/finally where if the exception could be fixed with an autofix in the process of catching the exception. The other would be in the sort of replacefootage instances that have cropped up as questions here.
I don't actually have a use case for it, just am following along with nab and if I set up an expression that introduces an error dialog to the user and then run a script that addresses the problem manually, it doesn't seem to produce the expected results.
Like I said, just trying to get my head around it.
Dale
not sure yet. I can see a couple of different ways I might like to autoFixExpressions(). The first would be in the context of a try/catch/finally where if the exception could be fixed with an autofix in the process of catching the exception. The other would be in the sort of replacefootage instances that have cropped up as questions here.
I don't actually have a use case for it, just am following along with nab and if I set up an expression that introduces an error dialog to the user and then run a script that addresses the problem manually, it doesn't seem to produce the expected results.
Like I said, just trying to get my head around it.
Dale
thanks to both of you, I thought autofix was sort of find/replace in all broken expressions found in the project.
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
dale... i'm not sure if setting an expression on a property, and that expr can't evaluate because of some syntax error or other issue, can be fixed by autoFixExpressions(); haven't tried, though. i think it's more intended to fix issues when your script changes a prop name referenced by expressions.
yeah, the docs can be clearer. i wish the Scripting Guide was available in LiveDocs format so the appropriate notes could be added to it immediately. i'll e-mail my contact to see what can be done.
thanks,
:jeff
yeah, the docs can be clearer. i wish the Scripting Guide was available in LiveDocs format so the appropriate notes could be added to it immediately. i'll e-mail my contact to see what can be done.
thanks,
:jeff