```
function writeReport(path, reportText) {
var reportFile = new File(path ); //path + "/font_report.txt"
if(reportFile.exists){
//alert('file already exists');
reportFile.open("w"); //reportFile.open("a"); //a是append模式
reportFile.write(reportText);
reportFile.close();
}
else{
var RCF_file = new File(reportFile);
RCF_file.open("w");
RCF_file.write(reportText);
RCF_file.close();
}
//alert('Report Complete');
}
//获取所有合成
var runType = 1;
//1---正常运行
//2---检测错误 @136@新郎:许鹏飞
//3---只文本
var str = "";
var index = 1;
// 获取当前激活的合成
var activeComp = app.project.activeItem;
if (activeComp == null )
{
alert("主合成没有激活,请修改下AE模板");
}
//----------第一层(最外面一层)开始
var curComp = activeComp;
if (curComp != null && (curComp instanceof CompItem))
{
//----------for numLayers 开始----------------------------
for (var i = 1; i <= curComp.numLayers; i++)
{
var curLayer = curComp.layer(i);
if (curLayer.shy == true)
continue;
if (curLayer.sourceText == null ) //curLayer != null && (curLayer instanceof CompItem)
{
//----------第二层开始
if (curLayer.source == null)
continue;
var curComp2 = curLayer.source;
//----------for numLayers 开始----------------------------
for (var i2 = 1; i2 <= curComp2.numLayers; i2++)
{
var curLayer2 = curComp2.layer(i2);
if (curLayer2.shy == true)
continue;
if (curLayer2.sourceText == null ) //if (curLayer2 != null && (curLayer2 instanceof CompItem))
{
}
else
{
//---------sourceText开始-----------------
//curLayer
var sourceText2 = curLayer2.sourceText;
if (sourceText2.numKeys == 0)
{
// textValue is a TextDocument. Retrieve the string inside
var oldString2 = sourceText2.value.text;
if(runType == 1)
str = str + "@" +index.toString() + "@"+ oldString2 + "\r\n";
if(runType == 2)
str = str + "@层名2:" + curLayer2.name + "@" +index.toString() + "@"+ oldString2 + "\r\n";
else if(runType == 3)
str = str + oldString2 + "\r\n";
else{}
index++;
}
else
{
// Do it for each keyframe:
for (var keyIndex2 = 1; keyIndex2 <= sourceText2.numKeys; keyIndex2++)
{
// textValue is a TextDocument. Retrieve the string inside
var oldString2 = sourceText2.keyValue(keyIndex2).text;
if(runType ==1)
str =str + "@" +index.toString() + "@"+ oldString2 + "\r\n";
if(runType == 2)
str = str + "@层名2:" + curLayer2.name + "@" +index.toString() + "@"+ oldString2 + "\r\n";
else if(runType == 3)
str = str + oldString2 + "\r\n";
else{}
index++;
}
}
//---------sourceText结束-----------------
}
}
//----------for numLayers 结束----------------------------
//----------第二层结束
}
else
{
//---------sourceText开始-----------------
//curLayer
var sourceText = curLayer.sourceText;
if (sourceText.numKeys == 0)
{
// textValue is a TextDocument. Retrieve the string inside
var oldString = sourceText.value.text;
//str = str + "@层名1:" + curLayer.name + "@" +index.toString() + "@"+ oldString + "\r\n";
if(runType == 1)
str = str + "@" +index.toString() + "@"+ oldString + "\r\n";
if(runType == 2)
str = str + "@层名2:" + curLayer.name + "@" +index.toString() + "@"+ oldString + "\r\n";
else if(runType == 3)
str = str + oldString+ "\r\n";
else{}
index++;
}
else
{
// Do it for each keyframe:
for (var keyIndex = 1; keyIndex <= sourceText.numKeys; keyIndex++)
{
// textValue is a TextDocument. Retrieve the string inside
var oldString = sourceText.keyValue(keyIndex).text;
//str = str + "@层名1:"+ "@" +index.toString()+"@" + oldString + "\r\n";
if(runType == 1)
str = str + "@" +index.toString() + "@"+ oldString + "\r\n";
if(runType == 2)
str = str + "@层名2:" + curLayer.name + "@" +index.toString() + "@"+ oldString + "\r\n";
else if(runType == 3)
str = str + oldString+ "\r\n";
else{}
index++;
}
}
//---------sourceText结束-----------------
}
}
//----------for numLayers 结束----------------------------
}
//----------第一层结束
//alert(str);
writeReport ("D:/提取的字幕.txt", str);
alert("提取字幕成功,位置为 D:/提取的字幕.txt");
```
- 脚本管理器
- 读取文件夹内文件
- 层层时间线偏移Sequencer.jsx
- 层层随机时间偏移
- 文字分离char_separate_1.3
- 分解文字 把一个文字层分成若干个文字层
- 快速导入Smart Import
- 查找与替换字符 Find and Replace Text.jsx
- 层改名Selected_Layers_Renamer.jsx
- 创建灯光为选择的三维层.jsx
- 创建摄像机为选择的三维图层.jsx
- 创建调节图层CreateTrimmedAdjustmentLayer.jsx
- 创建调节图层多个CreateSeveralTrimmedAdjustmentLayers.jsx
- 创建一个空物体到选择的层Add Parented Null to Selected Layers.jsx
- 文字分离DecomposeText
- 修改渲染输出文件位置Change Render Locations
- AE脚本读取txt文档并写入数组
- AE脚本把数组写入到txt文档中
- AE提取字幕脚本
- AE批量用txt内容替换字幕脚本