From: "Zack Lovatt" Received: from mail-oi0-f53.google.com ([209.85.218.53] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6444777 for AE-List@media-motion.tv; Thu, 03 May 2018 02:55:28 +0200 Received: by mail-oi0-f53.google.com with SMTP id e80-v6so14648833oig.11 for ; Wed, 02 May 2018 18:01:33 -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=j8XUZ4+kIy09ANbkvQKMayEn/PALz/x4mXZzAX+hJhs=; b=F+OgTqaXx3JIFocPX+WxxBU+DUnbQXOj217sYKBLVfwPKVFX26u3SeUQjTmZTds4Vf yrD7O/f9pIqMfiUoyHCXLbhgopM8LUdqLfkaPB5tWsixWMqNo6c02fbB7EneacRFWssn S8jtfDWmSFjt1S5MpvULJ/v6aSvCPEvTSa9e4/9zQrjQZoSwOYc1ujJU8yX3DdkDvwKw IB7tw9BC0aanuN4GQL01NLCf0P5hQpdvRpbE0h5bBT4okHdkO/TVgxL0u3XSYI5pEbmI 2iJ5dSqWGYPEP6xVWd8D/q5ByHRpk3F2008sDH9luR1YNZMrB7tgaOzfWJbCPSNHWLja tARg== 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=j8XUZ4+kIy09ANbkvQKMayEn/PALz/x4mXZzAX+hJhs=; b=I18H4efgYARXgQjg3Voigsfa/VvoUw+I56G8k1T4NOMvGOR+L+LYNiVHhc8AkbpOey TGgaUB0+YuH+M2cCC/l7CCulil/BJvMobrHOgw3jdjtoUhNB9/WNkEwNHRUqMWSGo8WQ QaUdAqvm1+Zum7xZ6+DGM3TPqYUty/+Iivs0nLLFm5NB881PA1X8SFCk5AbPR7EVPFu/ /Q9apQXAb227G9NyOlBL0NJNXZnUpMuLZfCyYvh3oUeLGXsof14SRWbKvSg+oPp6s3AP xlB4jd7WVB4TgZXew4OYQXIc8wybOVKpc9OqcGC97FSh0kI8dgxAR3WdEkh4FVXKybHm rQGg== X-Gm-Message-State: ALQs6tAelA/3rzyTvHoAy+Ul2+PAkmm54RRBDl74WWqs5UC0nlt2YH/+ s53oaIFJgZFAepq5Aif/61olVdyy1jmIqrAdxqlGW6o= X-Google-Smtp-Source: AB8JxZqIbjbBSoX37/ad25VkGIQ4j/fN5L4Q9YWxxt/gYileLOZ/xNF8iQdcwk3C7Yp405nCeeUMSxhh7MxeonuKZbg= X-Received: by 2002:aca:a4d:: with SMTP id 74-v6mr12982719oik.317.1525309291733; Wed, 02 May 2018 18:01:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.213.8 with HTTP; Wed, 2 May 2018 18:00:51 -0700 (PDT) X-Originating-IP: [45.49.154.120] In-Reply-To: References: Date: Wed, 2 May 2018 18:00:51 -0700 Message-ID: Subject: Re: [AE] scripting help - getting colour value To: After Effects Mail List Content-Type: multipart/alternative; boundary="00000000000081b638056b42bec1" --00000000000081b638056b42bec1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 scripts > 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. It > still doesn=E2=80=99t work. The colour control that is applied by the sc= ript works > as expected after the script has run, so there=E2=80=99s no issue with th= e script > applying the effect and the expression. > > I=E2=80=99ll try using a slider instead but I appreciate any other sugges= tions... > > > 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 applicatio= n > so that may not be possible, and the last time I tried sampleImage() I ha= d > 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 fin= e > 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 t= he > 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=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=3D > thisLayer.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 Col= or > 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 > --00000000000081b638056b42bec1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Can you post the full script?

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> wrote:
>>
>>
>> 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>

--00000000000081b638056b42bec1--