From: "TIM THIESSEN" Received: from resqmta-po-01v.sys.comcast.net ([96.114.154.160] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6447512 for ae-list@media-motion.tv; Tue, 08 May 2018 22:10:09 +0200 Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-01v.sys.comcast.net with ESMTP id G8XZfuBYnxFuSG927fBFr9; Tue, 08 May 2018 20:16:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1525810583; bh=LmgQ+S1cLT/rODTxKH4eX8/XDNmRKQgg3GSJQbCA9X4=; h=Received:Received:Date:From:Reply-To:To:Message-ID:Subject: MIME-Version:Content-Type; b=i1VywlTJrPSmKQjWlWrszLEHMykNyra0tHnAbZMOeEmSgnyjK1p2ovWtlrH5dRLn1 sudZ8QjSgoSkKYi/+uzBkDx6hwVL4Z3uGW8E4xx8Tipz2t79iwwQGIFa2FonnSREQt kik8YYQAEoFwGQ64FoczLpOm/ixFN+ZKZQaqsBzwQVFp3y14A7clUQBO+N7wFkwOKp Zlh+kSBaY//etyANCrpP5xccXlZyN2OyzoKbVcTMCxkbGeWFKGHArGflrX2RECHfgD d3egNVTp2qU9SW0WxYLdKjyqgJ3FXn+crP9BRfYnhIlSHcsNIXQFqZBNdMJEEGIVgt CIjt8nRjqFWVw== Received: from oxapp-hoc-48o.email.comcast.net ([96.118.241.125]) by resomta-po-01v.sys.comcast.net with ESMTPS id G927fEbxvmkAHG927fgTZY; Tue, 08 May 2018 20:16:23 +0000 Date: Tue, 8 May 2018 13:16:22 -0700 (PDT) Reply-To: TIM THIESSEN To: After Effects Mail List Message-ID: <527079736.1136024.1525810583138@connect.xfinity.com> In-Reply-To: <1455428762.1095010.1525654551383@connect.xfinity.com> References: <1455428762.1095010.1525654551383@connect.xfinity.com> Subject: Re: [AE] scripting help - applying a preset only once - SOLUTION! MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1136023_1919584365.1525810583130" X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev12 X-Originating-IP: ::ffff:107.1.199.10 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfOG2NUmbLrRBpskHevkn7TDnmlL9naLFUh8Cqi7pdeang19KbcmTeRe5ngX+wIeSM246yvGbw4FFYXYCNLVndGxAHtCu4e/goHx3GS1uaP8QwQh1xn5A ieyqGk5i0JViSuSP76a/z3LfBmMH62o6yYMXTW3gRyWHJAxPDrqSv5+YW1EnPkq5FWYK2SLu6glN8qNced/uTsGZwKBDyQc6ZZE= ------=_Part_1136023_1919584365.1525810583130 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Follow up to this scripting problem I was having - figured out a solution a= nd I wanted to share - basically check the number of properties in the "ADB= E Effects Parade" before I applied the preset, applied the preset and then = check the number of properties again after and if there were more than expe= cted I remove() the offending duplicate effects - it still flashes the effe= cts up there but it get the desired effect (no pun intended) Just thought I would share, it's been bugging me for a while and glad to ha= ve a solution - now to wrap that in a function so I can use it several plac= es in my script. Tim T > On May 6, 2018 at 5:55 PM TIM THIESSEN wrote: >=20 >=20 > I may have found my solution in David Torno's Free Function Friday - = episode 1 covers getting Layer Effects - that may be part of the ticket - D= avid Torno's series on extendscript along with Mathias M=C3=B6hl's class at= FXPhd Along with Llyod's class there are my main sources for learning Java= script. >=20 >=20 > Thanks >=20 > Tim T >=20 > > > On May 6, 2018 at 2:47 PM TIM THIESSEN wrote: > >=20 > >=20 > > ah that makes more sense > >=20 > >=20 > > thanks > >=20 > > > > > On May 6, 2018 at 2:35 PM Lloyd Alvarez wrote: > > >=20 > > > That was meant to say "not something you can check for" > > >=20 > > > On Sun, May 6, 2018 at 5:32 PM Lloyd Alvarez wrote: > > >=20 > > > > > > > Hi Tim > > > >=20 > > > > The preset is but something you can check for. You = need to check for what the preset applies whether is keyframes or expressio= ns you would check if that exists.=20 > > > >=20 > > > > Lloyd > > > >=20 > > > > On Sun, May 6, 2018 at 5:16 PM TIM THIESSEN wrote: > > > >=20 > > > > > > > > >=20 > > > > > Ok I have a script that applies an expression= to a single property (position for example) and a preset to that layer - I= only want to have that preset applied once and only once - because no matt= er how many times the preset to the layer the expressions are only going to= look at the first one. I'm using the try-catch method to check that the ef= fect is applied and if it that throws an error it will apply the preset. An= d for the most part it works great, the one time it breaks is if you have s= everal properties selected - it applies the same amount of presets as selec= ted properties. Ever other instance of using this script works - and since = it is applying the expression to the position property it shouldn't matter = if you have the properties selected or not. I'm not even checking if you do= have any properties selected. The snippet of code is: > > > > >=20 > > > > >=20 > > > > > if(BOUNCrType =3D=3D "Position"){ > > > > > if(positionFFX.exists =3D=3D 0){ //this check= to see if the preset exists > > > > > positionFFX =3D getFFXfile("BOUNCr_position.f= fx", "(BOUNCr_assets)", BOUNCr_position_ffx); > > > > > } > > > > > for (var i =3D 0; i < numSelected; i++){ > > > > > try{ > > > > > selLayers[i].property("Effects").property("BO= UNCr_Position").value !=3D null; //I tried the =3D=3D 1 but AE kept throwin= g an error > > > > > }catch(err){ > > > > > selLayers[i].applyPreset(positionFFX); //this= applies the preset to the layer if and only if it doesn't exist > > > > > } > > > > > if(selLayers[i].property("Transform").propert= y("Position").dimensionsSeparated){ > > > > > selLayers[i].property("Transform").property("= X Position").expression =3D posExpress; > > > > > selLayers[i].property("Transform").property("= Y Position").expression =3D posExpress; > > > > > if(selLayers[i].threeDLayer){ > > > > > selLayers[i].property("Transform").property("= Z Position").expression =3D posExpress; > > > > > } > > > > > }else{ > > > > > selLayers[i].property("Transform").property("= Position").expression =3D posExpress; > > > > > } > > > > > } > > > > > } > > > > >=20 > > > > >=20 > > > > > sorry for the formatting the funny thing this= more for almost every instance, it just fails when you have multiple prope= rties selected it instantly adds multiple instances of the preset. I'm tryi= ng to think of a solution, like checking to see if properties are selected = and then deselecting them (I don't know if that is possible - maybe throwin= g an alert is going to be the only solution) Any thoughts - this one is got= me pickled, I wish there was an .exists properties for effects. > > > > >=20 > > > > >=20 > > > > > Thanks, > > > > >=20 > > > > > Tim T > > > > >=20 > > > > > > > > > -- > > > > Cheers, Lloyd > > > >=20 > > > > > > > -- > > > Cheers, Lloyd > > >=20 > > > > >=20 > > >=20 ------=_Part_1136023_1919584365.1525810583130 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Follow up to this scripting problem I wa= s having - figured out a solution and I wanted to share - basically check t= he number of properties in the "ADBE Effects Parade" before I appli= ed the preset, applied the preset and then check the number of properties a= gain after and if there were more than expected I remove() the offending du= plicate effects - it still flashes the effects up there but it get the desi= red effect (no pun intended)


Just thought I would share, it's been bugging me for a while a= nd glad to have a solution - now to wrap that in a function so I can use it= several places in my script.


Tim T

On May 6, 2018 at 5:55 PM TIM = THIESSEN <pixelbot@comcast.net> wrote:

I may h= ave found my solution in David Torno's Free Function Friday - episode 1= covers getting Layer Effects - that may be part of the ticket - David Torn= o's series on extendscript along with Mathias Möhl's class at = FXPhd Along with Llyod's class there are my main sources for learning J= avascript.


Thanks

T= im T

On May 6, 2018 at 2:47 PM TIM THIESSEN &#= 60;AE-List@media-motion.tv> wrote:

ah that makes m= ore sense


thanks

On May 6, 2018 at 2:35 PM Lloyd Alvarez <AE-List@media-motion= .tv> wrote:

That was meant to say "not something y= ou can check for"

On Sun, May 6, 2018 at 5:32 PM Llo= yd Alvarez <AE-List@media-mo= tion.tv> wrote:
Hi Tim<= /div>

The preset is but someth= ing you can check for. You need to check for what the preset applies whethe= r is keyframes or expressions you would check if that exists. 

Lloyd

On Sun, May 6, 20= 18 at 5:16 PM TIM THIESSEN <AE-List@media-motion.tv&#= 62; wrote:

Ok I have a script that applies an expression to a single p= roperty (position for example) and a preset to that layer - I only want to = have that preset applied once and only once - because no matter how many ti= mes the preset to the layer the expressions are only going to look at the f= irst one. I'm using the try-catch method to check that the effect is ap= plied and if it that throws an error it will apply the preset. And for the = most part it works great, the one time it breaks is if you have several pro= perties selected - it applies the same amount of presets as selected p= roperties. Ever other instance of using this script works - and since it is= applying the expression to the position property it shouldn't matter i= f you have the properties selected or not. I'm not even checking if you= do have any properties selected. The snippet of code is:


if(BOUNCrType =3D=3D "Position"){
if(positionFFX.e= xists =3D=3D 0){ //this check to see i= f the preset exists
positionFFX =3D getFFXfile("BOUNCr_posit= ion.ffx", "(BOUNCr_assets)", BOUNCr_position_ffx);
}
fo= r (var i =3D 0; i < numSelected; i++){
try{
selLayers[i].proper= ty("Effects").property("BOUNCr_Position").value !=3D null; = //I tried the =3D=3D 1 but AE kept throwing= an error
}catch(err){
selLayers[i].applyPreset(positionFFX)= ; //this applies the preset to the layer if= and only if it doesn't exist
}
if(selLayers[i].property= ("Transform").property("Position").dimensionsSeparated){ selLayers[i].property("Transform").property("X Position")= .expression =3D posExpress;
selLayers[i].property("Transform").= property("Y Position").expression =3D posExpress;
if(selLayers[= i].threeDLayer){
selLayers[i].property("Transform").property(&#= 34;Z Position").expression =3D posExpress;
}
}else{
selLaye= rs[i].property("Transform").property("Position").expression= =3D posExpress;
}
}
}


sorry for = the formatting the funny thing this more for almost every instance, it just= fails when you have multiple properties selected it instantly adds multipl= e instances of the preset. I'm trying to think of a solution, like chec= king to see if properties are selected and then deselecting them (I don'= ;t know if that is possible - maybe throwing an alert is going to be the on= ly solution) Any thoughts - this one is got me pickled, I wish there was an= .exists properties for effects.


Thanks,

<= p style=3D"font-size: 12pt; font-family: helvetica,arial,sans-serif; color:= #333333;" class=3D"ox-b3e0a54744-ox-797dc5b661-ox-5617f0bfae-m_-7927264959= 067425343m_-5099138632992767653default-style">Tim T

<= /div>
--
Cheers, Lloyd
--
Cheers, Lloyd
=20 ------=_Part_1136023_1919584365.1525810583130--