From: "Zack Lovatt" Received: from mail-ot0-f172.google.com ([74.125.82.172] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6445231 for AE-List@media-motion.tv; Fri, 04 May 2018 02:50:39 +0200 Received: by mail-ot0-f172.google.com with SMTP id y10-v6so22740774otg.10 for ; Thu, 03 May 2018 17:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zacklovatt-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=pIIi7LLX1TUasl1i61IRrMwchHnR2Lg4BFbclXERcls=; b=BJEiV2dmSonNnMAnan+QTbq6+SFEnxpHxK62Zmdbov0Y9S5Bwwqh3JX+EQPJf6GS4Y Q+jIHbaGKJw4LBKmhIFVa5QG/PW94dsMBQjhWzsx5lRNkeGTB98V1VL4PQYDdkPlREeN OAlYF/d4l63TFCP5bxWvaqiDPCXCnovD9hwaxSd4jzCvL99nkJNstjGnzvdA/7rQyKAV +3StyoFLRKCLs9Oce09etjdS6Nf7JEbD93apCZKaG05oBxpcZ3rCqfdSOmRPEwnjbtgM 0KwgTvjX5oC7hnviLPYNTg60xF/XMPW5tKuWCZeFN/HqS9rpwlTajYiroVlWy0S5m+0e DqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=pIIi7LLX1TUasl1i61IRrMwchHnR2Lg4BFbclXERcls=; b=pgWZdiVgfj0HYuAnWXyMnNuuU/lC6NEuYS6OzVxvCnllok8OqkbycchsB+A2IERgj2 bpWbbIMCnzamMgm5VujIQUwUBzBkm4URZZFggH7F6tlhsMH+BP003Mm8kWcJBv1xt3gh RGQ0KVbrBV7q5a26iQVSsDjstWKmxyB2hAxCR9vXtbOwtwvbmEwJECiISY7Pn/K9Zg5q ikdmAWPbvkXXkTCFXARW9Ffh6vQr/Z0A4jiOQb3+2/uG90LOnYJpEZ1NeSoOh8boqH/l VDD4JPydEtLT3vYYKGxBkRE1GlpGgSfHjUTp2SmU0AQlRfB8+/Pr5zN7b1heNlB0inuh 4vKw== X-Gm-Message-State: ALQs6tB1Sto3ixZVJh3FIJPFeUBjbNXlrcDdPdM4G8OEHGwVIWbaqLVa 7qX0Zw6Eg7tGUCN68oU8+OO1ek7FLTUscmaWnWKYMgDpDA== X-Google-Smtp-Source: AB8JxZoa3phkgYhOZyWghljcfFUFqsK0HWHNQG6Oh8hzeMGhqRQIzNqO0TZc1C5y7AIocwSkbZOtzBTbt43UW00Lpac= X-Received: by 2002:a9d:38cc:: with SMTP id k12-v6mr19219396ote.398.1525395403736; Thu, 03 May 2018 17:56:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.213.8 with HTTP; Thu, 3 May 2018 17:56:03 -0700 (PDT) X-Originating-IP: [45.49.154.120] In-Reply-To: References: Date: Thu, 3 May 2018 17:56:03 -0700 Message-ID: Subject: Re: [AE] scripting help - getting colour value To: After Effects Mail List Content-Type: multipart/alternative; boundary="0000000000002e9941056b56cba9" --0000000000002e9941056b56cba9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Any chance you're doing something like *not *declaring variables, and so you're loading something into the global space? In that way if you don't close AE, run the script via File > Script and then Window > [Script.jsx], you'll already have initialized certain things. Best bet would be to post / share the full script so somebody else can check it out! Running this, based on your code above, yields the same working result regardless of whether it's run from File > Script or Window > Script.jsx (function () { var comp =3D app.project.activeItem; var layer =3D comp.selectedLayers[0]; layer.property("ADBE Effect Parade").addProperty("ADBE Color Control"); var colourControl =3D layer.property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001"); colourControl.expression=3D"var x =3D thisLayer.width / 2;\nvar y =3D thisLayer.height / 2;\nsampleImage([x,y], radius =3D [2, 2], postEffect =3D true, t =3D time);"; var rgbValue =3D colourControl.value; alert(rgbValue); })(); Zack Lovatt 424.442.0020 www.zacklovatt.com On Thu, May 3, 2018 at 4:29 PM, Chris Zwar wrote: > I should have tried this earlier, but I tested the script on older > versions of AE. It works fine in CS6, CC 2014 and I=E2=80=99m downloadin= g CC2015 > again to try it there. It doesn=E2=80=99t work in CC 2017 or 2018 so I= =E2=80=99m going to > assume it=E2=80=99s some sort of bug. > > FWIW I=E2=80=99ve noticed that other 3rd party scripts which do the same = thing I=E2=80=99m > doing also don=E2=80=99t work in CC 2018. > > Time to file a bug report... > > -Chris > > > On 3 May 2018, at 11:00 am, Zack Lovatt wrote: > > Can you post the full script? > > Zack Lovatt > 424.442.0020 > www.zacklovatt.com > > On Wed, May 2, 2018 at 5:51 PM, Chris Zwar > wrote: > >> I=E2=80=99ll have a look at using a variable but it=E2=80=99s simpler if= I don=E2=80=99t have >> to. >> >> The thing that stumps me is that the script works if run from the script= s >> menu, it just doesn=E2=80=99t work when opened from the windows menu. >> >> I had a quick play yesterday and I changed the .value to >> .valueAtTime(time, false). The =E2=80=9Cfalse=E2=80=9D flag is supposed= to force the >> return of the expression and not the underlying pre-expression value. I= t >> still doesn=E2=80=99t work. The colour control that is applied by the s= cript works >> as expected after the script has run, so there=E2=80=99s no issue with t= he script >> applying the effect and the expression. >> >> I=E2=80=99ll try using a slider instead but I appreciate any other sugge= stions... >> >> > On 3 May 2018, at 7:09 am, TIM THIESSEN >> wrote: >> > >> > I'm thinking the problem is you are applying an expression to the >> controller and then asking the value of the controller - the problem is >> that if you apply an expression to say position and then ask the for the >> value it returns the default position. rather than add the expression to >> sample the color just create a variable to sample the point you need and >> then it will return the correct color. I don't know your whole applicati= on >> so that may not be possible, and the last time I tried sampleImage() I h= ad >> some weird colors show up. >> > >> > tt >> > >> >> On April 30, 2018 at 10:29 PM Chris Zwar >> wrote: >> >> >> >> >> >> 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=E2=80=99t 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. Bu= t >> the same thing in a GUI and run from the ScriptsUI Panel doesn=E2=80=99t= 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=E2=80=9D); >> >> >> >> myLayer[0].property("ADBE Effect Parade").property("ADBE Color >> Control").property("ADBE Color Control-0001").expression=3D"x=3Dt >> hisLayer.width/2;y=3DthisLayer.height/2; c=3DsampleImage([x,y], radius = =3D [2, >> 2], postEffect =3D true, t =3D time);"; >> >> >> >> var RGB=3DmyLayer[0].property("ADBE Effect Parade").property("ADBE Co= lor >> Control").property("ADBE Color Control-0001").value; >> >> >> >> >> >> +---End of message---+ >> >> To unsubscribe send any message to >> > >> > +---End of message---+ >> > To unsubscribe send any message to >> >> >> +---End of message---+ >> To unsubscribe send any message to >> > > > --0000000000002e9941056b56cba9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Any chance you're doing something like not decl= aring variables, and so you're loading something into the global space?= In that way if you don't close AE, run the script via File > Script= and then Window > [Script.jsx], you'll already have initialized cer= tain things.
Best bet would be to post / share the full script so someb= ody else can check it out!


Runn= ing this, based on your code above, yields the same working result regardle= ss of whether it's run from File > Script or Window > Script.jsx<= /div>


(function () {
= =C2=A0 var comp =3D app.project.activeItem;
=C2=A0 var layer =3D comp.selectedLayers[0];

=C2=A0 layer.property("ADBE Effect Parade&= quot;).addProperty("ADBE Color Control");

=C2=A0 var colourControl =3D layer.property("ADBE Effect = Parade").property("ADBE Color Control").property("ADBE = Color Control-0001");
=C2=A0 colourControl.expression=3D"var x =3D thisLayer.width / 2;= \nvar y =3D thisLayer.height / 2;\nsampleImage([x,y], radius =3D [2, 2], po= stEffect =3D true, t =3D time);";

= =C2=A0 var rgbValue =3D colourControl.value;
=C2=A0 alert(rgbValue);
})();


<= /div>



Zack Lovatt
424.442.0020

On Thu, May 3, 2018 at 4:29 PM, Chris Zwar <= span dir=3D"ltr"><AE-List@media-motion.tv> wrote:
I should have tried this earlier, but I tested the script on older vers= ions of AE.=C2=A0 It works fine in CS6, CC 2014 and I=E2=80=99m downloading= CC2015 again to try it there.=C2=A0 It doesn=E2=80=99t work in CC 2017 or = 2018 so I=E2=80=99m going to assume it=E2=80=99s some sort of bug.

=
FWIW I=E2=80=99ve noticed that other 3rd party scripts which do = the same thing I=E2=80=99m doing also don=E2=80=99t work in CC 2018.
<= div>
Time to file a bug report...

-Chris
<= br>

On 3 May 2018, at 11:00 am, Zack= Lovatt <AE= -List@media-motion.tv> wrote:

Can you post the full sc= ript?

<= div dir=3D"ltr">
Zack Lovatt
424.= 442.0020

On Wed, May 2, 2018 at 5:51 PM, Chris Zwar <= span dir=3D"ltr"><AE-List@media-motion.tv> wrote:
I=E2=80=99ll have a look at using a variable but it=E2=80=99s= simpler if I don=E2=80=99t have to.=C2=A0

The thing that stumps me is that the script works if run from the scripts m= enu, it just doesn=E2=80=99t work when opened from the windows menu.

I had a quick play yesterday and I changed the .value to .valueAtTime(time,= false).=C2=A0 The =E2=80=9Cfalse=E2=80=9D flag is supposed to force the re= turn of the expression and not the underlying pre-expression value.=C2=A0 I= t still doesn=E2=80=99t work.=C2=A0 The colour control that is applied by t= he script works as expected after the script has run, so there=E2=80=99s no= issue with the script applying the effect and the expression.

I=E2=80=99ll try using a slider instead but I appreciate any other suggesti= ons...

> On 3 May 2018, at 7:09 am, TIM THIESSEN <AE-List@media-motion.tv> wrote: >
> I'm thinking the problem is you are applying an expression to the = controller and then asking the value of the controller - the problem is tha= t if you apply an expression to say position and then ask the for the value= it returns the default position. rather than add the expression to sample = the color just create a variable to sample the point you need and then it w= ill return the correct color. I don't know your whole application so th= at may not be possible, and the last time I tried sampleImage() I had some = weird colors show up.
>
> tt
>
>> On April 30, 2018 at 10:29 PM Chris Zwar <AE-List@media-motion.tv> wro= te:
>>
>>
>> Hi,
>>
>> Just after some scripting help.=C2=A0 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=E2=80=99t work any more.
>>
>> The aim is to sample the colour of a layer.=C2=A0 The script appli= es a colour control / expression control effect, with an expression that us= es sampleImage to read the RGB values.=C2=A0 The script then reads the valu= e of the colour control to get the RGB values.
>>
>> As I said - works fine if I run the script from the scripts menu.= =C2=A0 But the same thing in a GUI and run from the ScriptsUI Panel doesn= =E2=80=99t 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(&q= uot;ADBE Color Control=E2=80=9D);
>>
>> myLayer[0].property("ADBE Effect Parade").property("= ;ADBE Color Control").property("ADBE Color Control-0001").ex= pression=3D"x=3DthisLayer.width/2;y=3DthisLayer.height/2; c= =3DsampleImage([x,y], radius =3D [2, 2], postEffect =3D true, t =3D time);&= quot;;
>>
>> var RGB=3DmyLayer[0].property("ADBE Effect Parade").prop= erty("ADBE Color Control").property("ADBE Color Control-0001= ").value;
>>
>>
>> +---End of message---+
>> To unsubscribe send any message to <ae-list-off@media-motion.tv> >
> +---End of message---+
> To unsubscribe send any message to <ae-list-off@media-motion.tv>


+---End of message---+
To unsubscribe send any message to <ae-list-off@media-motion.tv>


--0000000000002e9941056b56cba9--