Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions add slider control in script

  • add slider control in script

    Posted by Rob Mcgowan on February 22, 2017 at 8:42 pm

    hi,
    I’m trying to write code that generates customizable shape layers with their own built in UI.

    My problem is I can’t find any documentation on adding effects through code.

    At the moment I’m trying to add a slider. With nothing to go on I tried

    thisLayer.effect.add(“Slider Control”);

    and it returns effect has no add method.

    Anyone point the way?

    Rob Mcgowan replied 9 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 22, 2017 at 8:50 pm

    You can do it like this:

    var myComp = app.project.activeItem;
    myLayer = myComp.layer(1);
    myLayer.property(“Effects”).addProperty(“Slider Control”);

    but it’s safer (if there’s any chance your script will be used in another language version of AE) to use the match names, like this:

    var myComp = app.project.activeItem;
    myLayer = myComp.layer(1);
    myLayer.property(“ADBE Effect Parade”).addProperty(“ADBE Slider Control”);

    Dan

  • Rob Mcgowan

    February 22, 2017 at 9:23 pm

    Thanks that works absolutely great.

    I searched the 192 page ADOBE CS6 scripting guide and found about 25 references to ADBE. Thats helpful but its not add anything like a comprehensive overview of the ADOBE class hierarchy that a beginner needs to understand the material. (The 25 references come down to maybe two or three examples mostly involving masks.)

    I’ve tried fiddling around with the data browser thing in the debug tool and it’s helpful here and there but not much.

    So my question is (and I apologize because I have asked it here before in a slightly different form) if it’s not in the docs then where should a beginner progress to understanding this object hierarchy so they don’t have to keep nagging the clever people?

  • Dan Ebberts

    February 22, 2017 at 9:43 pm

    I pretty much use three references when I’m writing a script: The AE Scripting Guide; Adobe’s JavaScript Tools Guide (for UI and file I/O stuff; and Jeff Almasol’s wonderful rd_GimmePropPath.jsx script (available here: https://www.redefinery.com/ae/rd_scripts/) which you can use to suss out property hierarchies and match names.

    Dan

  • Rob Mcgowan

    February 24, 2017 at 9:08 pm

    Jeff Almasol’s rd_GimmePropPath.jsx script is just amazing.

    I hadn’t used it up to now as I’m on CS4 and I couldn’t seem to find a compatible version at redefinery.

    For the benefit of anyone else on an older version who might not know, there’s a copy of version 2.0 which does work on CS4 to be found at github.

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