ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Ultra simple script (but failed....)

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
martin jean-s├ębastienUltra simple script (but failed....)
by on Nov 7, 2013 at 7:56:41 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!


Return to posts index

Gabriel ValkamaRe: Ultra simple script (but failed....)
by on Nov 19, 2013 at 10:55:00 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.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]