Forum Replies Created

  • Ok i found the solution… had to change variables value to a string:

    markerNr = thisComp.layer(“Werte_Speicher”).effect(“Auswahl-MarkerNr”)(1);
    landkreis = String(footage(“Landkreisauswahl.csv”).dataValue([1,markerNr]));
    l = thisComp.layer(landkreis);
    l.toComp(l.anchorPoint);

    this seems to work…

  • Did this already and works fine. No problem there – this is what bugs me. I can use it to get the text as source text and it always shows the correct string but as a Layer-Name it has problems… I think this really comes from the fact that you use “” for getting the Layer-Name. In my before post you can see i found a work around, the expression still shows error codes BUT it is working – don’t ask me why. Still hoping to find a proper solution that works without error…

  • i found a solution that (kind of) works BUT still shows an error (while working). I think the problem is with the String which i use to access the layer. So i tried to convert it to a String but maybe i did it wrong or it is not the problem. With adding four ‘ to the code, it seems to kind of work.

    The same when i enter the Layer-Name manually e.g.: l = thisComp.layer(“Berlin”);

    –> this works fine too.

    Here is the code that kind of works now:

    markerNr = thisComp.layer(“Werte_Speicher”).effect(“Auswahl-MarkerNr”)(1);
    landkreis = footage(“Landkreisauswahl.csv”).dataValue([1,markerNr]);
    l = thisComp.layer('' +landkreis +''); //<<--- here i added ''
    l.toComp(l.anchorPoint);

    But since it still shows an error i think there is something i am missing and i think it is they way it uses the String that i get from CSV… Hope someone can help me more

  • I found the error. In my first try, in each If-condition, i had only the linear() function as return value, without adding the value to a variable (in the old legacy-engine this worked fine).
    In the new version i added, that it writes the linear function to the variable “rotate_arrow” but also added the “else if”-condition which caused another problem.
    So just by changing the “else if” condition to an “else”-condition it works fine now. Easy fix for hours of searching the internet and try hundreds of variations… So the java engine really needs you to make a much cleaner code. I post the fix bellow, but i think for most people this would be obvious.

    (P.S.:Not sure i explain it correctly, but i am trying with my noob scripting skills).

    w1 = thisComp.layer("Werte_Speicher").effect("Durschnitt W1")("Schieberegler");
    w2 = thisComp.layer("Werte_Speicher").effect("Durschnitt W2")("Schieberegler");
    rotate_arrow = -90;
    if (w1 &lt; w2){
    rotate_arrow = linear(thisComp.layer("Werte_Speicher").effect("Trend_Pfeil1")("Schieberegler"),0,100,-90,-135);
    rotate_arrow;
    }
    if (w1 > w2){
    rotate_arrow = linear(thisComp.layer("Werte_Speicher").effect("Trend_Pfeil1")("Schieberegler"),0,100,-90,-45);
    rotate_arrow;
    }
    else {
    rotate_arrow;
    }

  • Really big thanks to you Filip…

    After changing the project to the java-engine, I messed a bit around with the code you send me and found the error. Forget to add +1 to the row counter! Now it works much faster. REALY big thanks for your great help 😉

  • ok, thanks, how could i miss this. I thought i had changed this before, but maybe because i took an old project, it changed back to the legacy engine. This now means a lot of more work needs to be done, since this makes a lot of scripts not functioning anymore. First have to try to get it back working, will report back later if everything worked out.

  • Still doesn´t seem to work, i think it has problem with the CSV for sure. The first and the last columns have dates and times – but both can be ignored (they are not needed and will change to a german date-from in future – if need to know this! So dates like 2020-07-22 will in future be 22.07.2020).
    But for my calculations if the max. value i only need the numbers in between.

    Here is the link:
    14245_dwallebl7tagesinzidenzzeitreihewide.csv.zip
    Really big THANKS for your great help and time spent!

  • Appreciate your help, but tried to get your code running… But still AfterEffects isn´t working with it.
    Here is a screenshot:

    I really new to scripting and just got most things to work, but your code is just hard to understand for me. Sorry to bother you, but would be happy to get this solved.

    Just one thought, how i maybe could get the project to be more performant with my old code – is there a way to stop the both “for-“loops after the last value is found/ or after a specific time frame. I tried to put the for-Loops into an if(time<1) …. “do maxValue calculation” else “displaymaxValue”;
    The start worked out but as soon as it finished the first secound, it set the maxValue back to 0. So i thought the last value of the for-loops would have overwritten the start value, but it seems it isn´t existing outside the for-loops – if i understand this correctly?
    Maybe i need to read more about how the variables are working.
    Edit: Maybe asked more shortly and simply: How do i get the maxValue i calculated via “for”-loops in the first second to exist, when i exit/stop my for-loops?

  • thx for the help, but i ran into some issues . Since i am really new with scripting, i get the error message “< does not have a value” and i am not sure what causes this.
    I implemented your code the way you can see in code below. Do i miss something (maybe a variable that need to be declared)? Or maybe it is something in my CSV-File that is not correctly formated.
    i added a screensshot of my example CSV-File. It has 18 columns and a variable number of rows, but i just need to check the columns 2-17 (or when started from 0, the columns 1-16), the both date columns can be ignored.

    Here is the screenshot of the CSV.

    end_row = Math.round(effect("END-Zeile_verstellbar")("Schieberegler")); //Last row in array to compare
    start_row = Math.round(effect("START-Zeile_verstellbar")("Schieberegler")); // Start Row in array to compare
    data = footage("dw_allebl_7tagesinzidenz_zeitreihe_wide.csv").sourceText.split(/\n/).map( (ln) => ln.split(",") );
    maxValue = Math.max.apply(-Number.MAX_VALUE,data.slice(start_row,end_row+1).flat());

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