Forum Replies Created

Page 2 of 3
  • In my case, I was looping through many properties, some have keyframes some don’t.
    If there is no keyframe the script tries to perform a for loop from 0 to greater than 0 by substraction.

    I found it easiest to just add an if condition.


    if(property.numKeys != 0){
    for (var i = (property.numKeys); i>=0; i--){property.removeKey(i)}
    }

  • Matthias Stoll

    April 28, 2020 at 2:19 pm in reply to: Skipping Hidden Properties with ExtendScript

    This method is great to select/adress all properties in a Comp. It was hard to find this here because your use case here is different.

    I’ve been trying to build this for some time now, never got it. I could not come up with the construct that the property becomes the function input as soon as it is “instanceof PropertyGroup”.

    I found out this doesn’t work for Mask Properties. But it is really easy to fix, just modify the first if-Statement to include “MaskPropertyGroup”.

    if (property instanceof PropertyGroup || property instanceof MaskPropertyGroup) {
    recursiveDisableExpressions(property);
    continue;

  • Matthias Stoll

    April 27, 2020 at 7:18 am in reply to: Scripting: access all expressions in Comp /

    Thank you!! Now I am not stuck anymore!

    I also read about for… in… Loops in the extend script manual. They are supposed to be good for “looping through properties”. I still haven’t figured them out, but I have hopes they give me a cleaner solution.

  • There is a documentation for the AE-menu-command-Id’s vor the app.execute() command, so here is a version which is independent from your UI language setup. (A friend told me when this script didn’t work for him.)

    https://www.provideocoalition.com/after-effects-menu-command-ids/

    var orgFIleUrl = app.project.file;
    var orgName= app.project.file.name;
    var comp = app.project.activeItem
    var rootfolder = orgFIleUrl.toString ().substr (0, orgFIleUrl.toString ().lastIndexOf ('/'));
    var comp = app.project.activeItem;
    var fileLoc = new File(rootfolder + "//" + comp.name +".aep");
    app.project.reduceProject(comp);
    new_project = app.project.save(fileLoc);
    app.executeCommand(16);
    var fileLoc = new File(rootfolder + "//" + orgName);
    new_project = app.project.save(fileLoc);

  • Matthias Stoll

    March 7, 2020 at 1:49 pm in reply to: Open Recent Menu

    The Prefs File has sections, and for me correct section seemed to be “Most Recently Used (MRU) Search v2”

    alert(app.preferences.getPrefAsString("Most Recently Used (MRU) Search v2","MRU Project Path ID # 1, File Path", PREFType.PREF_Type_MACHINE_SPECIFIC))

  • Thank you so much, this is great stuff! I’ve been looking for that some time now – always gave up. (And didn’t want to spend money on a script that performs 3 steps.)

    When I executed your script, I always came out with an empty project. Maybe because I did not go through the Extend Script Toolkit? I wanted to make it executable through “Run Script File…” in AE, so I made some changes and simplified it a bit. (mainly to understand better what I am doing).

    I reset to the original project simply by executing an “Undo Reduce Project” Command. So please note this only works if your using the english UI. The only thing you’ll need to translate in the code is the “Undo Reduce Project” part (Line 9), if you want to get it to work in other languages. I think from here it should be easy to add some gimmicks, like prompting for a different saving location.


    var orgFIleUrl = app.project.file;
    var orgName= app.project.file.name;
    var comp = app.project.activeItem
    var rootfolder = orgFIleUrl.toString ().substr (0, orgFIleUrl.toString ().lastIndexOf ('/'));
    var comp = app.project.activeItem;
    var fileLoc = new File(rootfolder + "//" + comp.name +".aep");
    app.project.reduceProject(comp);
    new_project = app.project.save(fileLoc);
    app.executeCommand(app.findMenuCommandId("Undo Reduce Project"));
    var fileLoc = new File(rootfolder + "//" + orgName);
    new_project = app.project.save(fileLoc);

  • hi Dan,

    I need to read out the Name of the contents of a shape layer “Shape 1”, “Shape 2” etc. to create a delay. I want to duplicate those Shapes to get an increasing number and increasing delays.

    Something like “thisContent.name” would help – which doesn’t exist.

    Do you know about any other way to create fixed increasing numbers? I mean besides Comp names or layer indexes. I want to create a toolbox with many different shape layer animations, each reduced to one single shape layer.

    Thanks a lot!

    on transform: Shape 1

    var mult=parseInt(content(1).name.split(" ")[1]);
    var delay= effect("delay")(1)*mult;
    anim=linear(time,0+delay,2+delay,0,1);
    P.pointOnPath(anim,time)

  • Matthias Stoll

    January 24, 2020 at 8:49 am in reply to: Random number within a range and hold it

    Talking about randoms, this is only a little bit related… I’ve been wondering about it quite a while now. In a project I had about 50 dots and I needed to connect with lines them in a “Plexus”-like fashion, but only some dots needed to connect.

    I used random expressions to target 2 dot-layers giving the coordinates for start and ending of every line (shape layers). Of course some of the results were equal, and I had to manually eliminate those double lines – because I could not think of another way.

    So my question: Can I somehow save results from a random expression and then exclude them from the range of the next one? All random expressions would need to connect to another expression doing this.

    This should be possible, any ideas out there?

  • Hi Tilman, hi everybody

    Thanks for the thread and all the ideas! I combined some of the ideas to do it, based on the Penner eases. In this expression you can define start and end values in two dimensions. On top 3 Penner functions are defined, at the bottom you have to pick between EaseIn, EaseOut, EaseInOut.

    I hope someone out there still needs this…

    EaseIn = function(power){return function(t){return Math.pow(t, power)}};
    EaseOut = function(power){return function(t){return 1 - Math.abs(Math.pow(t-1, power))}};
    EaseInOut = function(power){return function(t){return t<.5 ? EaseIn(power)(t*2)/2 : EaseOut(power)(t*2 - 1)/2+0.5}}

    dur=1; power=5; //1=linear, 2=Quad, 3=Cubic, 4=Quart, 5=Quint
    startX=value[0]; startY=value[1];
    endX= ; endY= ;

    t=linear(time-inPoint,0,dur,0,1);
    Exp=EaseOut(power)(t);
    x=startX+(endX-startX)*Exp;
    y=startY+(endY-startY)*Exp;
    [x,y]

  • Thank you!!!!!

Page 2 of 3

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