From: "TIM THIESSEN" Received: from resqmta-po-09v.sys.comcast.net ([96.114.154.168] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6446584 for ae-list@media-motion.tv; Sun, 06 May 2018 23:09:35 +0200 Received: from resomta-po-12v.sys.comcast.net ([96.114.154.236]) by resqmta-po-09v.sys.comcast.net with ESMTP id FQhEfQ4DuOfVLFR0UfsZc0; Sun, 06 May 2018 21:15:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1525641346; bh=pI95m+8WUVxtOK7dhzvAw8CQWII2hYkqtb9wMt9uONo=; h=Received:Received:Date:From:Reply-To:To:Message-ID:Subject: MIME-Version:Content-Type; b=KpD5APHP2F2GwAJn2/OyWzw5IwgGSdd9qlmihZFk+APCAbTCy5CyKihlzh9TT63wl m7oxclIMkZIHuqBAP9kuOknrdUj0HRGfQGRwazII5n2BGh56KqWQLeVIze4jexLH41 QZETvWhuBGmZQQsCPbTp1bNRMDmk1aeewU1qIjt/1idRQ4d/l7lGhHKiTGtNDnPBwt wXvBy0hv82zeX7vPb1OqUZcCJDyRZGsH/xjIkA6POLUQX+Akee8DynHXkXxIOJoA35 fK9UUoSYo/UIOTOUdulogE7b+Qqi2TkbKanhNmXAyNFr7bSFqGPTbggd/kciKqUHoZ UGVANjUWq68Zw== Received: from oxapp-hoc-48o.email.comcast.net ([96.118.241.125]) by resomta-po-12v.sys.comcast.net with ESMTPS id FR0TfdTsr1OeHFR0UfNsPA; Sun, 06 May 2018 21:15:46 +0000 Date: Sun, 6 May 2018 14:15:45 -0700 (PDT) Reply-To: TIM THIESSEN To: After Effects Mail List Message-ID: <994706706.1092063.1525641345847@connect.xfinity.com> In-Reply-To: References: Subject: scripting help - applying a preset only once MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1092062_602844198.1525641345844" X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev12 X-Originating-IP: ::ffff:24.21.84.163 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfNgbDN2ZuTu4s7yhJCzNImwkF62moEoGP0bCCX64kx9lvNZxUOvqWE6pAD5caC9koh+OCfCbm3jtsVMdtbWHx57ZoJp312dFc7nqiTSMXav8I3vE24vk 8x3ogewJz2isbU32oquR47DOboXiCpJoF/YDOsNGmu1ob24u1rziHdo6jOcFq7eHhID/5rsNBoMWsFQYAfcwg2wPIjF0ArY40yI= ------=_Part_1092062_602844198.1525641345844 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 matter 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 effect is applied 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 properties selected - it applies the same amount of presets as selected 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: if(BOUNCrType == "Position"){ if(positionFFX.exists == 0){ //this check to see if the preset exists positionFFX = getFFXfile("BOUNCr_position.ffx", "(BOUNCr_assets)", BOUNCr_position_ffx); } for (var i = 0; i < numSelected; i++){ try{ selLayers[i].property("Effects").property("BOUNCr_Position").value != null; //I tried the == 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 = posExpress; selLayers[i].property("Transform").property("Y Position").expression = posExpress; if(selLayers[i].threeDLayer){ selLayers[i].property("Transform").property("Z Position").expression = posExpress; } }else{ selLayers[i].property("Transform").property("Position").expression = 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 multiple instances of the preset. I'm trying 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 throwing 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. Thanks, Tim T ------=_Part_1092062_602844198.1525641345844 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Ok I have a script that ap= plies an expression to a single property (position for example) and a prese= t to that layer - I only want to have that preset applied once and only onc= e - because no matter how many times the preset to the layer the expression= s are only going to look at the first one. I'm using the try-catch meth= od to check that the effect is applied and if it that throws an error it wi= ll apply the preset. And for the most part it works great, the one time it = breaks is if you have several properties selected - it applies the sam= e amount of presets as selected properties. Ever other instance of using th= is script works - and since it is applying the expression to the position p= roperty 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 snip= pet of code is:


if(BOUNCrType =3D=3D "Position"){
if(po= sitionFFX.exists =3D=3D 0){ //t= his check to see if the preset exists
positionFFX =3D getFFXfile= ("BOUNCr_position.ffx", "(BOUNCr_assets)", BOUNCr_position_= ffx);
}
for (var i =3D 0; i < numSelected; i++){
try{
s= elLayers[i].property("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 a= pplies the preset to the layer if and only if it doesn't exist }
if(selLayers[i].property("Transform").property("Positi= on").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 posExpr= ess;
}
}else{
selLayers[i].property("Transform").proper= ty("Position").expression =3D posExpress;
}
}
}


sorry for the formatting the funny thing this more for almost every instan= ce, it just fails when you have multiple properties selected it instantly a= dds multiple instances of the preset. I'm trying 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 throwing an alert is going t= o be the only solution) Any thoughts - this one is got me pickled, I wish t= here was an .exists properties for effects.


Thanks,

Tim T

=20 ------=_Part_1092062_602844198.1525641345844--