我正在嘗試編寫一個腳本,將字符數組解析爲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