Mailing List AE-List@media-motion.tv — Message #63997
From: Chris Zwar <AE-List@media-motion.tv>
Subject: scripting help - getting colour value
Date: Tue, 1 May 2018 15:29:27 +1000
To: After Effects Mail List <AE-List@media-motion.tv>
Hi,

Just after some scripting help.  I have a simple script that works fine when run without a GUI, but if I use exactly the same code in a version with a GUI it doesn’t work any more.

The aim is to sample the colour of a layer.  The script applies a colour control / expression control effect, with an expression that uses sampleImage to read the RGB values.  The script then reads the value of the colour control to get the RGB values.

As I said - works fine if I run the script from the scripts menu.  But the same thing in a GUI and run from the ScriptsUI Panel doesn’t work. The RGB array variable is just 0. So what am I doing wrong?

Cheers,


-Chris

Offending code:

myLayer[0].property("ADBE Effect Parade").addProperty("ADBE Color Control”);

myLayer[0].property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").expression="x=thisLayer.width/2;y=thisLayer.height/2; c=sampleImage([x,y], radius = [2, 2], postEffect = true, t = time);";

var RGB=myLayer[0].property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").value;

 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster