我正在尝试编写一个脚本,将字符数组解析为After Effects中文本图层的后续关键帧。一切正常。只有我想更改函数来读取unicode而不是普通文本。Extendscript将unicode字符解析为文本图层
这里是我的脚本代码:
var textLayer = currentComp.layers.addText("test");
textLayer.name = "score";
textLayer.position.setValue([50,500]);
//Chose the txt with the array
var myFile = File.openDialog("Navigate to keyframe file.");
myFile.open("r");
var myLine = myFile.readln();
var keyValues = myLine.split(",")
var prop1 = app.project.item(1).layer(1).property("ADBE Text Properties").property("ADBE Text Document");
var arrayLength = keyValues.length;
//Keyframe Loop
app.beginUndoGroup("Keys");
for(var i=0; i<arrayLength; i++){
prop1.setValueAtTime([i]/25,keyValues[i]);
}
app.endUndoGroup();
而这正是我试图解析字符串:
\u5c07,\u63a2,\u8a0e,\u53ca,\u5176,\u4ed6
这些都是Unicode字符。
你能不能熬您的代码段下来,不用的字体,没有一个文本文件,有人能执行吗?或者至少提供您正在尝试解析的文件或字符串? – fabianmoronzirfas
@fabiantheblind完成:) – vinni