Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Ultra simple script (but failed….)

  • Ultra simple script (but failed….)

    Posted by Martin Jean-sébastien on November 7, 2013 at 7:56 am

    Posts: 2
    Hello,
    I’m new in scripting, and I try to make a really simple script. Here it is :

    {
    app.beginUndoGroup(“Particular script”);
    // Creating project
    var currentProject = (app.project) ? app.project : app.newProject();
    // Creating comp
    var compSettings = cs = [1920, 1080, 1, 120, 25];
    var defaultCompName = “Particular Script”;
    var currentComp = cc = (currentProject.activeItem) ? currentProject.activeItem : currentProject.items.addComp(defaultCompName, cs[0], cs[1], cs[2], cs[3], cs[4]);
    currentComp.openInViewer();

    // Creating particular layer, ajouter effet particular et ajouter effet parametre glissiere
    var myWord = “Curseur”;
    var particularLayer = currentComp.layers.addSolid([93, 5, 2], “Particular”, cs[0], cs[1], cs[2]);
    var effetParticular = particularLayer.Effects.addProperty(“Particular”);
    var effetNbParticules = particularLayer.Effects.addProperty(“ADBE Slider Control”);
    effetNbParticules.name = “nbParticules”;

    effetNbParticules.property(1).setValue(500);
    effetParticular.property(“Particles/sec”).setValue(1);
    effetParticular.property(“Particles/sec”).expression = “value*thisComp.layer(“” + effetNbParticules.name + “”)(“”+myWord+ “”)”;

    app.endUndoGroup();
    }

    Any idea?

    Thanks!

    Gabriel Valkama replied 12 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Gabriel Valkama

    November 19, 2013 at 10:55 am

    had to replace the .expression line with this:

    effetParticular.property(“Particles/sec”).expression = (“value*thisComp.layer(\”” + effetNbParticules.name + “\”)(\””+myWord+ “\”)”);

    as you have to use \” inside a string to get a “. Otherwise it ends the string.

    Don’t know why the “Particles/sec” lines don’t work though, sorry.

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