Forum Replies Created

Page 12 of 65
  • Andrei Popa

    November 9, 2021 at 2:00 pm in reply to: AE Scripting: trying to edit text in a layer

    Hi Rob.

    Replacce var zoom = compEditing.layer(1).text.sourceText.value with var zoom = compEditing.layer(1).text.sourceText.value.text.

    Your code returns a variable that is of type TextDocument, not string. That variable also contains font, fontSize, fontFamily, text and other data.

  • Hi Clement. I think you need one of the following expressions, based on whether the second value of y position is greater or smaller than the first. The linear() function needs the 2nd parameter to be smaller than the 3rd.

    So if the position of your second keyframe is lower than the first, use this

    dropMenu = effect("Dropdown Menu Control")("Menu");
    myListe = [195.7, 258.2, -320.7];
    myPlace = myListe[dropMenu - 1];
    key1 = key(1).value[1];
    key2 = key(2).value[1];
    yVal = linear(value[1], key1, key2, key1, key2 + myPlace);
    [value[0], yVal];

    Otherwise, use this

    dropMenu = effect("Dropdown Menu Control")("Menu");
    myListe = [195.7, 258.2, -320.7];
    myPlace = myListe[dropMenu - 1];
    key1 = key(1).value[1];
    key2 = key(2).value[1];
    yVal = linear(value[1], key2, key1, key2 + myPlace, key1);
    [value[0], yVal];

    You need to modify these a little to fit your project.

  • Yes. When rendering, it calculates that expression only once, at the start of the composition. It should only be used for expressions that do not change for the entire duration of the composition.

  • Andrei Popa

    October 28, 2021 at 6:46 am in reply to: How area texts are pushed into a new line?

    Autoleading is equal to 1.2 of the size of the font. However, if the autoleading is selected, myStyle.leading returns the value that the leading had before autoleading. So if your font is 100 px and leading 80 and you decide to set autoleading, the paragraph looks as if the leading would be 120. But myStyle.leading still returns 80. So that is why that line is there.

  • Andrei Popa

    October 27, 2021 at 7:48 am in reply to: How area texts are pushed into a new line?

    Hi Tomas. sourceRectAtTime reads only the text size if used with false value for include extents. Like this sourceRectAtTime(time, false).height;

    If all you want is to know how many lines there are, you can use this function for that.

    //L=layer, T=time

    function getNumRows(L, T) {

    var H = L.sourceRectAtTime(L.sourceTime(T), false).height;

    var myStyle = L.text.sourceText.style;

    myFontSize = myStyle.fontSize;

    myLeading = myStyle.autoLeading ? myFontSize * 1.2 : myStyle.leading;

    return Math.ceil((H - myFontSize*0.5) / myLeading);

    }

    getNumRows(thisLayer,0);

  • Andrei Popa

    October 22, 2021 at 7:11 pm in reply to: Create Markers from External File.

    You need some more information, as the time for each marker. IDK of such a script but it would not be that hard to do one. Here is one that puts a marker from your file at each second

    var myFile = File.openDialog("Please select markers file");

    putMarkers(myFile);

    function putMarkers(myFile) {

    var markers = [];

    if (myFile.open("r")) {

    var fileString = myFile.read();

    markers = fileString.split("\n");

    myFile.close();

    } else {

    alert(myFile.error);

    }

    for (var i = 0; i < markers.length; i++) {

    addMarker(app.project.activeItem.selectedLayers[0], markers[i], i + 1);

    }

    function addMarker(myLayer, comment, time) {

    var myMarker = new MarkerValue(comment);

    myLayer("Marker").setValueAtTime(time, myMarker);

    }

    }

  • Andrei Popa

    October 22, 2021 at 6:47 pm in reply to: control inpoint/starttime with script

    When you set the duration of the composition it is a composition object. You can’t set the startTime of a composition object. For startTime, you need a layer object. That means that first you have to put your composition inside another composition. When you have done that, you have your composition used as an AVLayer inside the second composition. Only on this one can you set the startTime.

  • Andrei Popa

    October 21, 2021 at 6:06 pm in reply to: How to detect and affect only numbers contained in text

    The numbers don’t seem to react to the .toUpperCase() function. If I use .toUpperCase() on “andrei popa” I get “ANDREI POPA” but if I use it on a number, nothing happes. The numbers only seem to react to the “All Caps” button from the character panel. I don’t know how to apply that button effect to only one part of the text.

  • Andrei Popa

    October 20, 2021 at 1:49 pm in reply to: How to detect and affect only numbers contained in text

    I can test this if you can give me an example of a font that has upper case numbers (never heard of such a thing actually). Whithout testing, this could work, written in the text source.

    text.sourceText.replace(/^[0-9]+$/, function(v) { return v.toUpperCase(); });

  • Are your texts always gonna be on same line?

    If ever the words are too long and they have to descend to the next line, things get a lor more complicated. I imagine the simplest case would be 2 words, left justified texts. Second word should have this attached to the position. They should also be consecutive in the timeline, meaning the first word should be the layer above the second word.

    posterizeTime(0);

    L = thisComp.layer(index - 1);

    R = L.sourceRectAtTime(0, false);

    W = R.width;

    diff = 20;

    L.position + [W + diff, 0];

Page 12 of 65

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