FORUMS: list search recent posts

Set marker comment using .jsx script file

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Allard Rothengatter
Set marker comment using .jsx script file
on Oct 7, 2016 at 9:48:44 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


Return to posts index

Dan Ebberts
Re: Set marker comment using .jsx script file
on Oct 7, 2016 at 11:56:20 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



Return to posts index

Allard Rothengatter
Re: Set marker comment using .jsx script file
on Oct 7, 2016 at 12:10:09 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!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]