Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scripting changes from AE4 to CS6?

  • Scripting changes from AE4 to CS6?

    Posted by Shane Betts on May 22, 2013 at 3:50 am

    Hi guys

    Sorry for the dopey question but I’m trying to set up an expression in CS6, using an example (or examples) I found on the net in some old tutee for AE4. But, when I paste the sample expression into my CS6 comp, it returns errors, the prime one being “Expected: ;” in Line 2.

    Anyone with any thoughts? Thanks heaps in advance.

    Cheers
    Bettsy

    if ($.os.indexOf("Mac") != -1)
    myPath = "/ae_texts/";
    else
    myPath = "file://c:ae_texts";
    myPath += "text_1.txt";
    $.evalFile (myPath);
    eval(thisComp.name);sentences = type.split("$");
    m = thisLayer.marker.nearestKey(time);n = m.index;
    if (time < thisLayer.marker.nearestKey(time).time) {n = n-1}
    subtitle = sentences[n];
    subtitle

    Shane Betts replied 13 years, 2 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    May 22, 2013 at 4:39 am

    One thing I see is that the second line shouldn’t have the semicolon at the end.

    Dan

  • Shane Betts

    May 22, 2013 at 1:06 pm

    Thanks Dan. I remove that and now it has a problem with the if/else statement, which it doesn’t seem to recognise as one and calls the use of the reserved word illegal. Confusing…

    Cheers
    Bettsy

  • Dan Ebberts

    May 22, 2013 at 1:21 pm

    This doesn’t generate any errors for me:

    if ($.os.indexOf(“Mac”) != -1)
    myPath = “/ae_texts/”
    else
    myPath = “file://c:ae_texts”;
    myPath += “text_1.txt”;

    Dan

  • Shane Betts

    May 22, 2013 at 1:25 pm

    Hey thanks Dan! You rock. I’ll try that and work outwards from there, although I can probably get by without the extra goodies anyway.

    Cheers
    Bettsy

  • Shane Betts

    May 24, 2013 at 10:01 am

    Hey Dan

    Finally had the chance to try that. For me this returns the file path as the text in the composition. In other words, my comp now displays /ae_texts/text_1.txt rather than the content of that file or any warning that it can’t find or read the file.

    Cheers
    Bettsy

  • Dan Ebberts

    May 24, 2013 at 2:48 pm

    That was just to fix the first error message you were getting–it was just meant to replace the first five lines of your expression.

    The only other thing I can see that doesn’t look right is the “<” character in the last if statement has been replaced with the HTML equivalent, but that could have happened when you pasted your code into the forum if you did a Preview Post before posting it, so it may not be that way in your original code.

    Dan

  • Shane Betts

    May 24, 2013 at 2:52 pm

    Hey Dan. I really appreciate your time on this. I have trolled this forum a little more and I believe I have found another post of yours with a solution.

    I’ll also look out the html substitution when I’m working from online tutes.

    Thanks mate!

    Cheers
    Bettsy

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy