Japanese scripters are better informed

Find out why the . goes before the /

Moderator: Paul Tuersley

nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

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' ?
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Have you looked in the PDF scripting guide provided by Adobe?

The site you mention simply looks like an export of that document.
bradshaw1965
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.
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
bradshaw1965
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:

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
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

bradshaw1965 wrote: http://safari.ciscopress.com/032141294X/ch08lev1sec3

That should help in sussing out those undocumented methods
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)
bradshaw1965
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...
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

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
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

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:

Code: Select all

effect("Slider Control")("xxx");
and now execute this script:

Code: Select all

app.project.autoFixExpressions("xxx", "Slider");
nothing happens

( tried with numbers, same (non)result )

any suggestion ?
bradshaw1965
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
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

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
bradshaw1965
Posts: 98
Joined: March 14th, 2006, 2:16 pm
Location: Atlanta, GA
Contact:

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
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

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
bradshaw1965
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
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

thanks to both of you, I thought autofix was sort of find/replace in all broken expressions found in the project.
User avatar
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
Post Reply