Premiere Pro提供了一个ExtendScript API,允许访问和操纵大多数项目元素,包括元数据,导出和渲染选项。
脚本资料:https://ppro-scripting.docsforadobe.dev/application/application.html
脚本资料介绍并不完全,我你们可以通过反射来获取对象完整的属性和方法
function reflectProps(obj) {
var props = obj.reflect.properties;
for (var i = 0, len = props.length; i < len; i++) {
try {
$.writeln(props[i].name + ' = ' + obj[props[i].name]);
WriteData(props[i].name + ' = ' + obj[props[i].name])
} catch (e) {}
}
}
function reflectMeths(obj) {
var meths = obj.reflect.methods;
for (var i = 0, len = meths.length; i < len; i++) {
try {
$.writeln(meths[i].name + '();');
WriteData(meths[i].name + '();')
} catch (e) {}
}
}
function WriteData(Txt)
{
var file = new File(Folder.desktop + "/rflection.txt");
file.open("a", "TEXT",null);
file.encoding = "UTF8";
file.seek(0,2);
$.os.search(/windows/i) != -1 ? file.lineFeed = 'windows' : file.lineFeed = 'macintosh';
file.writeln(Txt);
file.close();
}
// Example of use:
// var r = new ActionReference();
// var d = new ActionDescriptor();
// r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
// d.putReference(charIDToTypeID('null'), r);
// var options = executeAction(charIDToTypeID( "getd" ), d, DialogModes.NO);
//app.activeDocument.activeLayer
var lay =app
WriteData("\n***************"+"["+lay.constructor.name+" ]"+" properties **********************\n")
reflectProps(lay);
WriteData("\n***************"+"["+lay.constructor.name+" ]"+" methods **********************\n")
reflectMeths(lay);
红色为新版本增加的属性和方法
Pr 2017:
***************[Application ] properties **********************
version = 11.0.0
build = 154
getPProPrefPath = C:/Users/test/Documents/Adobe/Premiere Pro/11.0/Profile-test/
getPProSystemPrefPath = C:/Program Files/Common Files/Adobe/Adobe Premiere Pro CC 2017/
project = [object Project]
anywhere = [object Anywhere]
encoder = [object Encoder]
userGuid = 19EF2B355F62E9E70A495C64@AdobeID
getAppPrefPath = C:/Users/test/Documents/Adobe/Premiere Pro/11.0/Profile-test/
getAppSystemPrefPath = C:/Program Files/Common Files/Adobe/Adobe Premiere Pro CC 2017/
csxs = [object Csxs]
metadata = [object Metadata]
getLookInfo = {}
__proto__ = [object Object]
***************[Application ] methods **********************
bind();
unbind();
setTimeout();
isDocumentOpen();
isDocument();
openDocument();
quit();
trace();
openFCPXML();
setSDKEventMessage();
setScratchDiskPath();
broadcastPrefsChanged();
setExtensionPersistent();
getEnableProxies();
setEnableProxies();
getCCXUserJSONData();
Pr2021:
***************[Application ] properties **********************
version = 15.2.0
build = 35
getPProPrefPath = C:/Users/test/Documents/Adobe/Premiere Pro/15.0/Profile-test/
getPProSystemPrefPath = C:/Program Files/Common Files/Adobe/Adobe Premiere Pro 2021/
project = [object Project]
anywhere = [object Anywhere]
encoder = [object Encoder]
userGuid =
getAppPrefPath = C:/Users/test/Documents/Adobe/Premiere Pro/15.0/Profile-test/
getAppSystemPrefPath = C:/Program Files/Common Files/Adobe/Adobe Premiere Pro 2021/
metadata = [object Metadata]
getLookInfo = {}
learnPanelContentDirPath = C:\Users\Public\Documents\Adobe\Premiere Pro 2021\Learn Panel\
learnPanelExampleProjectDirPath = C:\Users\Public\Documents\Adobe\Premiere Pro\15.0\Tutorial\Going Home project\
path = C:\Program Files\Adobe\Adobe Premiere Pro 2021\
production = null
projectManager = [object ProjectManager]
projects = [object ProjectCollection]
properties = [object Properties]
sourceMonitor = [object SourceMonitor]
__proto__ = [object Object]
***************[Application ] methods **********************
bind();
unbind();
setTimeout();
isDocument();
isDocumentOpen();
openDocument();
quit();
trace();
openFCPXML();
setSDKEventMessage();
setScratchDiskPath();
broadcastPrefsChanged();
setExtensionPersistent();
getEnableProxies();
setEnableProxies();
getConstant();
getCurrentProjectViewSelection();
getProjectFromViewID();
getProjectViewIDs();
getProjectViewSelection();
getWorkspaces();
isWindowVisible();
newPrProduction();
openPrProduction();
refresh();
setEnableTranscodeOnIngest();
setProjectViewSelection();
setWorkspace();
showCursor();
write();
addEventListener();
removeEventListener();
dispatchEvent();
onItemAddedToProjectSuccess();
enableQE();
1.判断是否有文档打开
app.isDocumentOpen();
2、设置工作区,pr2020版本以上
app.setWorkspace("编辑");
3.以JSON字符串形式从主机应用程序获取用户个性化数据。
app.getCCXUserJSONData();