Activity › Forums › Adobe After Effects Expressions › How to create Text markers using script?
-
How to create Text markers using script?
Posted by Johanna Peterson on September 19, 2012 at 5:32 pmHi ! I was wondering if there’s a way using script to add Markers in the text layers? I have the time codes where I wanted the words to appear but its more efficient if I can use a script to input all the Markers in the Text layers. Thanks!
Aleks Cicha replied 11 years, 9 months ago 4 Members · 12 Replies -
12 Replies
-
Dan Ebberts
September 19, 2012 at 6:27 pmYou can use a script to add markers to any layer, but I’m not sure how that helps you exactly. Were you going to link marker comments to the source text via an expression, or are you actually thinking of source text keyframes, or ???
Dan
-
Johanna Peterson
September 19, 2012 at 6:43 pmHello again! Im sorry if I didn’t explain it in the beginning on how it will help me. I’m actually using the subtitle script online, that loads the subtitles from a text file and creates the Text Keyframes from the created Markers on the Text layer. I’ve added the markers manually by inputting the timecodes on the timeline. So I was wondering how to possibly create the Markers on the Text layers without doing it manually. I have the all time codes were the subtitles should appear. Thank you!
-
Dan Ebberts
September 19, 2012 at 9:38 pmI’m still not completely sure what you’re trying to do, but this little script example will create a marker on the selected layer at 2 seconds with the comment “test comment”:
{
var myLayer = app.project.activeItem.selectedLayers[0];
var myMarkerVal = new MarkerValue(“test comment”);
myLayer.property(“Marker”).setValueAtTime(2, myMarkerVal);
}I hope that helps.
Dan
-
Johanna Peterson
September 20, 2012 at 3:03 pmHi Dan, thanks for this. This is helpful too, but what I really wanted to do is if say for example, I have these time codes (0;01;00;08, 0;01;03;03, 0;01;03;04, 0;01;05;09, 0;01;05;10) were I need to put the Marker on my Text Layer how do you do that in script? I really dont need the Marker Value at the moment, just placing the Markers into the Text layer.
THanks Dan!
-
Dan Ebberts
September 20, 2012 at 11:14 pmMaybe like this then:
{
var timeCodes = "0;01;00;08, 0;01;03;03, 0;01;03;04, 0;01;05;09, 0;01;05;10";
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)
}
}
Dan
-
Federico Ponce
September 19, 2013 at 10:53 pmHi, were do you enter this script?
{
var timeCodes = “0;01;00;08, 0;01;03;03, 0;01;03;04, 0;01;05;09, 0;01;05;10”;
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)
}
} -
Dan Ebberts
September 19, 2013 at 11:02 pmYou would first save that as a .jsx file and then run it from the File menu: File>Scripts>Run Script File…
Dan
-
Federico Ponce
September 19, 2013 at 11:25 pmunable to run script line 1. syntax error:
var timeCodes = “0;01;00;08, 0;01;03;03, 0;01;03;04, 0;01;05;09, 0;01;05;10”;
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) -
Aleks Cicha
October 10, 2014 at 9:43 amHi there, I am trying to create a number of intervals in a set time intervals, let’s say 1 marker every 10 frames…. Is there any way to include that in the script?
Reply to this Discussion! Login or Sign Up
