From: "Chris Zwar" Received: from mail-pf0-f169.google.com ([209.85.192.169] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6445213 for AE-List@media-motion.tv; Fri, 04 May 2018 01:23:34 +0200 Received: by mail-pf0-f169.google.com with SMTP id p12so15924941pff.13 for ; Thu, 03 May 2018 16:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chriszwar-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=T1uMh3D8SgleTPJ1jsfQyes8THnPYQsGbJOb3Zcw4uo=; b=QjDNvG7us2VXS5HliGdkWfjXyMYG3I+HFIfpXh9/vxy2wDP8xg+pwC52FDSCPQErXD tqZfF8k62P32Om664FiwyCL9UmkSAx2HnzHBvWWYg1Keh8jQH+YhzUmOfTjVyxif0Hvz MJauoIHee2jiBLWmd6UmZ7Swz+mPGJhcuB700T/YCAI9QjUpyR/sGSpNqyVLFiUbFGzD l/mnskpm0pDXCI2ulGlUH/q6r6OcyjzDI8bD15RVyyy4bxLQFnS8nz1lcPQkhyBz9FHO rf3E3KDAyUBwLmYXcVHdQvypHiqRNfiDSZOcZar5MIO++Qs1Rfwwz19R4B7ztCZjN87W ILvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=T1uMh3D8SgleTPJ1jsfQyes8THnPYQsGbJOb3Zcw4uo=; b=KMccL4TBS9/OqceUBj3wD+G3WWi+LfSiZWXf/nAxiRcMY2HMYgfSLnDkFugjsL4k6y SAZlNfMEM8Rsyz5suWmlxRpyckZbJmYfRS+HYjN9BWrE5xOlk6MsJUJyvALOWWZzzniU cZmb1DevWhtG//Bn48aoCFR35du/tQ8Ex37LSYMYHWLfaads5DZTLEJlNTRUD/QSllQV QMWycAYsfXF0/lYwcM0rl2ZUAXBxZJdMIVsYnaSsZf4/bljipvLG8NJSiBs8nMnVZ6qO TvERqsSSyoSMlIbBKKMMekkHi09qfjnQNnhjXVqkLFVeaD3KvP3nBE56RtY3Q2HQf6Vk ke8g== X-Gm-Message-State: ALQs6tDBSAKSh5jWkkm7m7419o5ZErPWBE+sbeGdpe3YNG3d8I/bbaLK cVGh72xVlrtoxNimTm/aiRIAETbqgyw= X-Google-Smtp-Source: AB8JxZrNtOm/FK8igUOurlr0FFjnH/9uzjWot1mg7kCJJV2rfX1In2xljt4DiADcJ8KuJnDjPMOBbA== X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr25645608plt.91.1525390178423; Thu, 03 May 2018 16:29:38 -0700 (PDT) Return-Path: Received: from [192.168.3.137] (220-244-139-34.static.tpgi.com.au. [220.244.139.34]) by smtp.gmail.com with ESMTPSA id 185sm30368048pfu.13.2018.05.03.16.29.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 16:29:37 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_08F3F5E4-8CE4-4DED-90C6-8C5785C80335" Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [AE] scripting help - getting colour value Date: Fri, 4 May 2018 09:29:33 +1000 References: To: After Effects Mail List In-Reply-To: Message-Id: <93BC0BB3-E256-4B71-94A1-B8DC13CD8808@chriszwar.com> X-Mailer: Apple Mail (2.3445.6.18) --Apple-Mail=_08F3F5E4-8CE4-4DED-90C6-8C5785C80335 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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 = downloading 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: >=20 > Can you post the full script? >=20 > 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. =20 >=20 > 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. >=20 > 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 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. >=20 > I=E2=80=99ll try using a slider instead but I appreciate any other = suggestions... >=20 > > On 3 May 2018, at 7:09 am, TIM THIESSEN > wrote: > >=20 > > 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 = application so that may not be possible, and the last time I tried = sampleImage() I had some weird colors show up. > >=20 > > tt > >=20 > >> On April 30, 2018 at 10:29 PM Chris Zwar > wrote: > >>=20 > >>=20 > >> Hi, > >>=20 > >> 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. > >>=20 > >> 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. > >>=20 > >> 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=99= t work. The RGB array variable is just 0. So what am I doing wrong? > >>=20 > >> Cheers, > >>=20 > >>=20 > >> -Chris > >>=20 > >> Offending code: > >>=20 > >> myLayer[0].property("ADBE Effect Parade").addProperty("ADBE Color = Control=E2=80=9D); > >>=20 > >> myLayer[0].property("ADBE Effect Parade").property("ADBE Color = Control").property("ADBE Color = Control-0001").expression=3D"x=3DthisLayer.width/2;y=3DthisLayer.height/2;= c=3DsampleImage([x,y], radius =3D [2, 2], postEffect =3D true, t =3D = time);"; > >>=20 > >> var RGB=3DmyLayer[0].property("ADBE Effect Parade").property("ADBE = Color Control").property("ADBE Color Control-0001").value; > >>=20 > >>=20 > >> +---End of message---+ > >> To unsubscribe send any message to > > >=20 > > +---End of message---+ > > To unsubscribe send any message to > >=20 >=20 > +---End of message---+ > To unsubscribe send any message to > >=20 --Apple-Mail=_08F3F5E4-8CE4-4DED-90C6-8C5785C80335 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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 = downloading 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=99= ve noticed that other 3rd party scripts which do the same thing I=E2=80=99= m 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 <AE-List@media-motion.tv> wrote:

Can you post the full script?

Zack = Lovatt
424.442.0020

On Wed, May 2, 2018 at 5:51 = PM, Chris Zwar <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. 

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 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 = suggestions...

> 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 = 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 = application so that 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.  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.  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=3DthisLayer.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 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>


= --Apple-Mail=_08F3F5E4-8CE4-4DED-90C6-8C5785C80335--