From: "Steve Zuranski" Received: from mail-wm0-f42.google.com ([74.125.82.42] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 7112049 for AE-List@media-motion.tv; Fri, 06 Jul 2018 17:01:20 +0200 Received: by mail-wm0-f42.google.com with SMTP id b188-v6so15237673wme.3 for ; Fri, 06 Jul 2018 08:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=yxtZ0zLytpAUvBPRb45RbbxTtiaOr/3xuQLmivnFdpg=; b=EKdgTIqOfTTtVZ+UdIn576s8QXyRR56TmuJ/5wwEDcLk6Njh7cDH+cANkjYlP1TAGZ 65SklICiZI3GdwsEM53IwExGJlOYLKafEuDk9eOLHGYQoAjCdqXjPsZhNZ1ewLUmyyH7 RjrS15DdED8jUA+gp7ghRW7oYcjyyNkKwUCjuqBkkj0pGnMBbvI7L9QMu10T+S/FR8n+ j99TdwnPB1FAvE/UWAk8lkF0K4sZF3sV+awiLyiI6ZorIOFe/4fayplCdis733Ch0Q7S nlwISi9t5WnzcATuCJ32OXhoaMPtfIMwpHtPLVIFeDak3K58y5q2zKxbkaVz/w+bEL2c MSVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=yxtZ0zLytpAUvBPRb45RbbxTtiaOr/3xuQLmivnFdpg=; b=FTyYtAb+C33ornyeIBzTYy4c05q5/Mp1opeYXrkkk2szcfed8ePfwUy399QzA9AoaS LtH5g5oSM/KbiiOxErJMhyk34nQ5H/KbZIw+IJE4ymSko1vuFyra7iFrl5eYvDv/2Wc/ gdJF06Jx+NuNfPlc/Wq05ZW0x4eca+N4E1uJOOKhTUEBB2LaN3aIv2hpBtY6/P/ndE4F uV+37SDC0SaHXK0hzSdxQAFkkxRePW8NZZnwNnOiyPVVUb7axcK97vtD0wRYNH7ptQC/ 4hyks9tdX8d6ce9U4CT872ezgpVT8VEjWf8xqpajEHHaLBy6HhLyH+0+58Hj5qTbzwhD Ezyg== X-Gm-Message-State: APt69E3sft4MOwtxyG6Lcq3NCZApujv5z5ukb6ou7f5aEDfotOu7Rdi/ RYr1Ib1uXccPd3gGhODgez+rqEXntOV+nYe5OBQN5Q== X-Google-Smtp-Source: AAOMgpcJC6PgMQrOsiw/vvVLiSeKln2K5tOOz8eJKS1qxTgKvcrlT/C2N28FPvQERp19LHvRbdBhaUg/ky1h8BYXoGo= X-Received: by 2002:a1c:9788:: with SMTP id z130-v6mr7259147wmd.88.1530889776399; Fri, 06 Jul 2018 08:09:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 6 Jul 2018 10:09:24 -0500 Message-ID: Subject: Re: [AE] Try Catch expression To: AE-List@media-motion.tv Content-Type: multipart/alternative; boundary="0000000000005009160570560d15" --0000000000005009160570560d15 Content-Type: text/plain; charset="UTF-8" I have not tested this and I have not done any AE scripting in years. Why don't you inspect the length of the string before you attempt to read at an out of bounds index rather than using a try catch statement? Also what do the error messages say? That will help in determining the cause. // Get the length of the string. txtVal = thisComp.layer("ab").text.sourceText; fps = 1/thisComp.frameDuration; Ch = 3; length = txtVal.value.text.length; if(length >= Ch-1) { txtVal.charCodeAt(Ch-1)/fps; }else{ 0; } On Fri, Jul 6, 2018 at 10:04 AM Steve Zuranski wrote: > I have not tested this and I have not done any AE scripting in years. Why > don't you inspect the length of the string before you attempt to read at an > out of bounds index rather than using a try catch statement? > > Also what do the error messages say? That will help in determining the > cause. > > // Get the length of the string. > txtVal = thisComp.layer("ab").text.sourceText; > fps = 1/thisComp.frameDuration; > Ch = 3; > length = txtVal.value.text.length; > > if(length >= Ch-1) { > txtVal.charCodeAt(Ch-1)/fps; > }else{ > 0; > } > > > On Fri, Jul 6, 2018 at 6:07 AM Robert Kjettrup > wrote: > >> Hi >> >> im using .charCodeAt() to get a Unicode value from a textlayer to >> timeremap a precomp, this is working great to use custom graphics to type >> out words. >> >> But im having a small problem with AE giving me an expression error if i >> use the charCodeAt() to read from a chararcter there is higher than the >> length of the textstrring of the text layer >> >> >> This error is not really problematic since it renders fine.... but now >> that i have set up a larger project i have the expression warning banner >> tell me about 55 errors, and that is quite annoying. >> >> Now im trying to use the Try Catch to get AE to ignore this error and not >> return a warning for each layer that has this expression reading outside >> the length of a textstring... but i cant get it to work. >> What am i doing wrong. >> >> the setup is as follows: >> >> a precomp with a bitmat characters setup at framenumbers that match the >> Unicode value that .charCodeAt() returns. >> >> This expression on the TimeRemap property of each copy of the character >> comp, this is character 3, aka copy 3 of this comp: >> >> >> txtVal = thisComp.layer("ab").text.sourceText; >> fps = 1/thisComp.frameDuration; >> Ch = 3; >> txtVal.charCodeAt(Ch-1)/fps >> >> >> And the Try/Catch method i cant get to work >> >> txtVal = thisComp.layer("ab").text.sourceText; >> fps = 1/thisComp.frameDuration; >> Ch = 3; >> try { txtVal.charCodeAt(Ch-1)/fps } catch(err) { 0 } >> >> >> >> and a link to a screengrab of a simplified version of my setup: >> https://adobe.ly/2NtbdHv >> > --0000000000005009160570560d15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= I have not tested this and I have not done any AE scripting in years. Why d= on't you inspect the length of the string before you attempt to read at= an out of bounds index rather than using a try catch statement?

<= /div>
Also what do the error messages say? That will help in determining the= cause.

// Get the len= gth of the string.
txtVal =3D thisComp.layer(&= quot;ab").text.sourceText;
fps =3D 1/thisComp.frameDuration;
Ch =3D 3;
length =3D txtVal.value.text.length;

if(length >=3D Ch-1) {
<= /span>txtVal.charCodeAt(Ch-1)/fps;
}else{
0;
}


On Fri, Jul 6, 20= 18 at 10:04 AM Steve Zuranski <sz= uranski@gmail.com> wrote:
= I have not tested this and I have not done any AE scripting in years. Why d= on't you inspect the length of the string before you attempt to read at= an out of bounds index rather than using a try catch statement?

<= /div>
Also what do the error messages say? That will help in determining the= cause.

// Get the len= gth of the string.
txtVal= =3D thisComp.layer("ab").text.sourceText;
fps =3D 1/thisComp.frameDuration;
<= div>Ch =3D 3;
length =3D txtVal.value.text.length;

if(length >=3D Ch-1) {<= /span>
txtVal.charCodeAt(Ch-1)/fps;
}else{
0;
}


On Fri, Jul 6, 20= 18 at 6:07 AM Robert Kjettrup <AE-List@media-motion.tv> wrote:
Hi

im using .charCodeAt() to = get a Unicode value from a textlayer to timeremap a precomp, this is workin= g great to use custom graphics to type out words.

But im having a small problem with AE giving me an express= ion error if i use the charCodeAt() to read from a chararcter there is high= er than the length of the textstrring of the text layer


This error is not really problematic since it renders fine.... b= ut now that i have set up a larger project i have the expression warning ba= nner tell me about 55 errors, and that is quite annoying.

Now im trying to use the Try Catch= to get AE to ignore this error and not return a warning for each layer tha= t has this expression reading outside the length of a textstring... but i c= ant get it to work.
What am i doing wrong.

the setup= is as follows:
a precomp with a = bitmat characters setup at framenumbers that match the Unicode value that .= charCodeAt() returns.

This expres= sion on the TimeRemap property of each copy of the character comp, this is = character 3, aka copy 3 of this comp:


txtV= al =3D thisComp.layer("ab").text.sourceText;
fps =3D 1/= thisComp.frameDuration;
Ch =3D 3;
txtVal.charCodeAt(Ch-= 1)/fps


And the Try/Catch method i cant ge= t to work=C2=A0
txtVal =3D t= hisComp.layer("ab").text.sourceText;
fps =3D 1/thisComp= .frameDuration;
Ch =3D 3;
try { txtVal.charCodeAt(Ch-1)= /fps } catch(err) { 0 }


and a link to a screengrab of a= simplified version of my setup:
https://adobe.ly/2Nt= bdHv
--0000000000005009160570560d15--