Page 1 of 2
Japanese scripters are better informed
Posted: December 9th, 2006, 10:33 am
by nab
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' ?
Posted: September 12th, 2007, 5:36 am
by Atomic
Have you looked in the PDF scripting guide provided by Adobe?
The site you mention simply looks like an export of that document.
Posted: September 12th, 2007, 1:19 pm
by bradshaw1965
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.
Posted: September 19th, 2007, 8:39 pm
by bradshaw1965
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:
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]);
}
http://safari.ciscopress.com/032141294X/ch08lev1sec3
That should help in sussing out those undocumented methods
on reflection
Posted: September 19th, 2007, 9:21 pm
by redefinery
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?
:jeff
(deflated that he can no longer save this nugget for a future scripting book)
Posted: September 20th, 2007, 5:50 am
by bradshaw1965
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...
book thoughts
Posted: September 20th, 2007, 10:17 pm
by redefinery
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...
yeah, the docs could be clearer in identifying the parts of the shared ExtendScript stuff applies to After Effects.
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
Posted: September 21st, 2007, 11:22 am
by nab
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:
Code: Select all
app.project.autoFixExpressions("xxx", "Slider");
nothing happens
( tried with numbers, same (non)result )
any suggestion ?
Posted: September 26th, 2007, 11:24 am
by bradshaw1965
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
autoFixExpressions()
Posted: September 26th, 2007, 8:38 pm
by redefinery
nab wrote:
I'm having trouble with autoFixExpressions, does it work for you ?
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
Re: autoFixExpressions()
Posted: September 27th, 2007, 6:31 am
by bradshaw1965
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
Hey 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
Re: autoFixExpressions()
Posted: September 27th, 2007, 8:01 am
by redefinery
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.
hey dale,
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
Posted: September 27th, 2007, 12:42 pm
by bradshaw1965
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
Posted: September 27th, 2007, 3:01 pm
by nab
thanks to both of you, I thought autofix was sort of find/replace in all broken expressions found in the project.
Posted: September 27th, 2007, 10:54 pm
by redefinery
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