使用前
记得打开 编辑-> 首选项 -> 脚本与表达式 -> 允许脚本访问网络与文件读写
更新
0.0.3 修复了下,少var了一个变量。
使用方法
把文件放在AE脚本路径的UI Panel 文件夹里。
运行ae
选择一个图层,点击“翻译”按钮,将获取图层中的效果的所有参数,并保存到桌面文件(AE translattion xxx.txt)。
后续做笔记啊 弄中英对照都会方便很多
源码
/* 名称:翻译小助手
* 版本号:0.0.2
* 说明:选择一个图层,点击“翻译”按钮,将获取图层中的效果的所有参数,并保存到桌面。
* 源码:https://www.yuelili.com/?p=21499
*/
var panelGlobal = this;
var dialog = (function () {
// UI开始
var dialog = (panelGlobal instanceof Panel) ? panelGlobal : new Window("palette");
if (!(panelGlobal instanceof Panel)) dialog.text = "翻译小助手0.0.1";
dialog.orientation = "column";
dialog.alignChildren = ["center", "top"];
dialog.spacing = 10;
dialog.margins = 16;
var btn = dialog.add("button", undefined, undefined, { name: "btn" });
btn.helpTip = "选择要翻译的图层";
btn.text = "开始获取属性名称";
btn.onClick = myFunction;
// 函数功能区
var res = ""
File.prototype.write_file = File.prototype.write_file || function (data) {
this.open('w', undefined, undefined);
this.encoding = "UTF-8";
this.write(data);
this.close();
}
function property_recursive(propertyGroup) {
for (var i = 1; i <= propertyGroup.numProperties; i++) {
var property = propertyGroup.property(i);
if (property instanceof PropertyGroup) {
property_recursive(property);
res += "----\n\n"
continue;
}
res += property.name + "\n";
}
}
function effect_recursive(layer) {
var eff = layer.property("ADBE Effect Parade");
for (var i = 1, l = eff.numProperties; i <= l; i++) {
res += "-------" + eff(i).name + "| Start-------\n"
property_recursive(eff(i)) // 对每个效果进行操作
res += "-------" + eff(i).name + "| End-------\n"
}
}
function get_format_time() {
var nowDate = new Date();
var yy = nowDate.getFullYear();
var mm = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
var dd = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
var hh = new Date().getHours()
var mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
var ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
dateTime = yy + '' + mm + '' + dd + '-' + hh + '' + mf + '' + ss
return dateTime
}
function myFunction() {
var f = new File(Folder.desktop.fsName.replace("\\", "/") + "/AE translattion " + get_format_time() + ".txt");
var layer = app.project.activeItem.selectedLayers[0];
res = ""
if(!layer) {
alert("请选择要翻译的图层")
return;
}
effect_recursive(layer)
f.write_file(res);
alert("已完成")
}
// UI结束
dialog.layout.layout(true);
dialog.layout.resize();
dialog.onResizing = dialog.onResize = function () { this.layout.resize(); }
if (dialog instanceof Window) dialog.show();
return dialog;
}());