Copy link to clipboard
Copied
Hey, I am currently coding an after effect expression but I get an error at the line 5 . It says ''Expected: ;'' but I checked everything and made no mistake.
This expression is put directly on the source text property of a text layer.
My code allows to decompose a srt syntax, and to have the live text synchronized on a single text layer.
My code :
text_srt = thisComp.layer("1 00:00:00,500 --> 00:00:02,999 Les codes de couleur du sous-titrage pour les sourds et les malentendants. 2 00:00:03,001 --> 00:00:05,999 Le magenta pour les indications musicales. 3 00:00:06,001 --> 00:00:08,999 Le vert pour les indications ou retranscriptions de langues étrangères.").text.sourceText;
text_separer = text_srt.split('\r');
srtText = text_separer ;
for (let i = 0; i < text_separer.length; i++) {
srtTime = srtText[1].split(" --> ");
startTimeSrt = srtTime[0];
endTimeSrt = srtTime[1];
subtitleText = srtText.slice(2);
subtitleTime = {
start: startTimeSrt,
end: endTimeSrt
};
subtitle = {
time: subtitleTime,
text: subtitleText[0]
};
k = 0;
while (k == 0) {
if (srtText[0] == '') {
srtText.shift();
k = 1;
} else {
srtText.shift();
}
}
}
Copy link to clipboard
Copied
Your workflow makes no sense. Why store the string to process in the layer name? That's just terrible. The rest appears to be your code making no sense since the outputs are not encapsulated as strings and not concatenated accordingly and you have extraneous spaces. This looks like you copy & pasted it from a script or a more complex expressions and the functionality broke down simply because expressions work differently than your code.
Mylenium