
Subtitle script demonstration
3 years ago
In case you're wondering WTF this is about, this link explains it all :)
ithowto.ro/2008/12/adobe-after-effects-subtitle-script/
ithowto.ro/2008/12/adobe-after-effects-subtitle-script/
-
Vimeo: About / Blog / Developers / Jobs /
Community Guidelines /
Help Center / Video School / Music Store / Site Map
/ Vimeo
or
-
Legal: TM + ©2012 Vimeo, LLC. All rights reserved. / Terms of Service / Privacy Statement / Copyright

Prev week
I am on a mac, and I've even tried creating the file on a PC in notepad, what am I doing wrong? Please help me! Thank you!
function makeSubs() {
var layer = app.project.activeItem.selectedLayers[0];
if (layer.property("sourceText") != null) {
var textFile = fileGetDialog("Select a text file to open.", "");
if (textFile != null) {
var textLines = new Array();
textFile.open("r", "TEXT", "????");
while (!textFile.eof)
textLines[textLines.length] = textFile.readln();
textFile.close();
var sourceText = layer.property("sourceText");
var markers = layer.property("marker");
for (var i = sourceText.numKeys; i >= 1; i--)
sourceText.removeKey(i);
var line = 0;
var subTime, subText;
for (var i = 1; i <= markers.numKeys; i++) {
subTime = markers.keyTime(i);
sourceText.setValueAtTime(0, " ");
if ((i % 2) == 0) {
subText = " ";
}
else {
subText = textLines[line].replace("|", "\x0d\x0a");
line++;
}
sourceText.setValueAtTime(subTime, new TextDocument(subText));
}
}
}
}
makeSubs();
}]
This will altered version i made does work. before it was declaring a variable type that need not be declared, leave it null and it will work seamlessly. Let me know if you have any other trouble.
Thanks, Colin :)