Hi everyone, I was looking for a script to color specific character sequences, and finally cobbled this together, which for me works on single instances of the color matches, and they work combined (I have three extra colors that certain text needs to have). This is for animating some videos for dyslexic children, and apparently coloring certain bits of text helps ☺
This works with plain “range selectors”.
//This set would set "foo", "bar", "do", "re" or"mi" to the desired color.
//Range selector START
wordsToHighlight = ["foo","bar","do","re","mi"];
amountOfWords = wordsToHighlight.length;
var txt = text.sourceText;
for(i = 0; i < amountOfWords; i++){
theword = wordsToHighlight[i];
if (txt.indexOf(theword) != -1){
txt.indexOf(theword);
break;
}
}
//Range selector END
wordsToHighlight = ["foo","bar","do","re","mi"];
amountOfWords = wordsToHighlight.length;
var txt = text.sourceText;
for(i = 0; i < amountOfWords; i++){
theword = wordsToHighlight[i];
if (txt.indexOf(theword) != -1){
txt.indexOf(theword) + theword.length;
break;
}
}