Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Set marker comment using .jsx script file

  • Set marker comment using .jsx script file

    Posted by Allard Rothengatter on October 7, 2016 at 9:48 am

    Gents,

    Quick question: I’ve added some markers to my timeline using script. Now I’d like to add some text to the comment field using script as well. Any clues on how this can be done?

    Example script:

    {
    var timeCodes = "0;00;01;00,0;00;02;00,0;00;03;00,0;00;04;00,0;00;05;00";
    var splitTC = timeCodes.split(",");
    var myComp = app.project.activeItem;
    var myLayer = myComp.selectedLayers[0];
    for(var i = 0; i < splitTC.length; i++){
    t = currentFormatToTime(splitTC[i],myComp.frameRate);
    myLayer.property("Marker").addKey(t);
    }
    }

    I’ve tried several options, however without succes. My guess it should be something like the code below, but this yields an error:

    myLayer.property("Marker").keyValue(i).comment = "Helllo Marker " + i;

    Any help would be much appreciated.

    Cheers,
    Allard

    Allard Rothengatter replied 9 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 7, 2016 at 11:56 am

    At the top of your code, define a Marker, like this:

    var myMarker = new MarkerValue(“”);

    Inside your loop, do something like this:

    t = currentFormatToTime(splitTC[i],myComp.frameRate);
    myMarker.comment = “some comment”;
    myLayer.property(“Marker”).setValueAtTime(t,myMarker);

    Dan

  • Allard Rothengatter

    October 7, 2016 at 12:10 pm

    Thanks Dan,

    Will dive into it right away. One more question though. I need to add markers to several layers plus the comp itself. Do you know how to select layers by name in the JSX script.

    Bit of background info on this specific question: I have a textfile containing a JavaScript object consisting of titles and normal text. I’d like to be able to load this text instead of copying all data manually.

    The text file looks as follows:

    var mainData = {
    "titles" : {
    "0;00;05;00" : "Title one",
    "0;00;10;00" : "Title two",
    "0;00;15;00" : "Title three",
    }
    "text" : {
    {
    "inpoint" : "0;00;06;00",
    "outpoint" : "0;00;09;00",
    "bullets" : {
    "0;00;06;00" : "Bullet number one",
    "0;00;07;00" : "Bullet number two",
    "0;00;08;00" : "Bullet number three",
    }
    },

    {
    "inpoint" : "0;00;11;00",
    "outpoint" : "0;00;14;00",
    "bullets" : {
    "0;00;11;00" : "Bullet number one",
    "0;00;12;00" : "Bullet number two",
    "0;00;13;00" : "Bullet number three",
    }
    },

    }
    }

    In the object above, markers for the titles section need to be added to say layer(‘title’) where the timecode is the key. The “text” section first needs to add two markers to the comp, triggering an animation, at the in and outpoint. Next the “bullets” need to be added at the corresponding times to the layer(‘bullets’) where the timecode is the key again.

    Any clue on how to achieve this?

    Thanks again!

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