Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Capture an Expression result in a Script

  • Capture an Expression result in a Script

    Posted by Forrest Maready on April 28, 2011 at 3:45 pm

    Greetings friends-
    I’m trying to run a script that employs the sampleImage method. I don’t believe it’s available via scripting, so I’m having to use an expression to access the sampleImage method. Currently, I’m piping the output of the sampleImage method to a Color property, which is something I can capture via Scripting.

    1.) Is there a way to capture the expression result directly in a script?
    2.) Is there a better way of using sampleImage in a script (not an expression)?

    Many thanks-

    Xavier Gomez replied 14 years, 6 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    April 28, 2011 at 4:08 pm

    Scripting can’t get to individual pixel data directly. I can’t think of a better way to do it than what you’re doing already.

    Dan

  • Forrest Maready

    April 28, 2011 at 5:11 pm

    Thanks- I was afraid of that. Seems to work fine, just not very pretty.

  • Xavier Gomez

    November 8, 2011 at 7:58 pm

    I up this thread since i have the same question as its title, which is not fully answered: can a script read an expression ?

    In my case, the script is taking into account some sliders values, calculates something with them, and returns “something”.
    It’s working well when the sliders only have keyframes, but the expressions are not taken into account by the script. Is this a normal behavior and is there a way to pass by ?

    I actually have another question, quite independant:
    The built-in and third-party effects have comprehensive custom controls, for instance: X scale and Y scale are linked by default, checking a checkbox will enable a previously disabled option, etc.
    Can one achieve this with a custom effect ? Can a script disable a slider? I tried .disable(), .hide() but apparently that only works for the UI palette: .disable() is not defined for my properties…

    Hopefully i was clear. Thx in advance !

  • Dan Ebberts

    November 9, 2011 at 12:07 am

    When you retreive your slider values with valueAtTime(time,preExpression), just set the preExpression parameter to false to have the results of the expression included in the value.

    >Can one achieve this with a custom effect ?

    Are you talking about hacking the PresetEffects.xml file? I don’t think that will give you want you want. You’d have to create a plugin.

    >Can a script disable a slider?

    Again, I think you’re in plugin territory if you want to control an effect’s UI.

    Dan

  • Xavier Gomez

    November 9, 2011 at 11:43 am

    God ! thx a lot ! valueAtTime(time,false) is working so well !

    pretty unintuitive though. I had initially used
    Progression=myControl.property(“Progression”).valueAtTime(t,myControl);
    thinking that setting preExpression to be ‘myControl’ would tell AE to look what’s there.
    Anyway, works fine now.

    For the auxialiary question, too bad, but that’s what i was expecting.
    I’m writing a script that wanna be a plugin…

    thank you again.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy