FORUMS: list search recent posts

How to create Text markers using script?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Johanna Daluz Peterson
How to create Text markers using script?
on Sep 19, 2012 at 5:32:12 pm

Hi ! 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!


Return to posts index

Dan Ebberts
Re: How to create Text markers using script?
on Sep 19, 2012 at 6:27:05 pm

You 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



Return to posts index

Johanna Daluz Peterson
Re: How to create Text markers using script?
on Sep 19, 2012 at 6:43:03 pm

Hello 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!


Return to posts index


Dan Ebberts
Re: How to create Text markers using script?
on Sep 19, 2012 at 9:38:37 pm

I'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



Return to posts index

Johanna Daluz Peterson
Re: How to create Text markers using script?
on Sep 20, 2012 at 3:03:17 pm

Hi 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.

Like this:


THanks Dan!


Return to posts index

Dan Ebberts
Re: How to create Text markers using script?
on Sep 20, 2012 at 11:14:36 pm

Maybe 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



Return to posts index


Johanna Daluz Peterson
Re: How to create Text markers using script?
on Sep 20, 2012 at 11:50:55 pm

You are amazing Dan! Thanks a lot!


Return to posts index

Federico Ponce
Re: How to create Text markers using script?
on Sep 19, 2013 at 10:53:01 pm

Hi, 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)
}
}


Return to posts index

Dan Ebberts
Re: How to create Text markers using script?
on Sep 19, 2013 at 11:02:23 pm

You would first save that as a .jsx file and then run it from the File menu: File>Scripts>Run Script File...




Dan



Return to posts index


Federico Ponce
Re: How to create Text markers using script?
on Sep 19, 2013 at 11:25:57 pm

unable 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)


Return to posts index

aleks cicha
Re: How to create Text markers using script?
on Oct 10, 2014 at 9:43:33 am

Hi 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?


Return to posts index

Dan Ebberts
Re: How to create Text markers using script?
on Oct 10, 2014 at 4:48:59 pm

Like this maybe:


var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var t = myLayer.inPoint;
while (t < myLayer.outPoint){
myLayer.property("Marker").addKey(t);
t += myComp.frameDuration*10;
}


Dan



Return to posts index


aleks cicha
Re: How to create Text markers using script?
on Oct 13, 2014 at 11:32:43 am

wow! That's amazing! You saved around a day of my work!!!!!
Many thanks Dan!

Best,

A.


Return to posts index

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