(function () {
var item = app.project.activeItem;
if (!(item instanceof CompItem)) {
alert('请激活活动合成');
return;
}
var layer = item.selectedLayers[0];
if (!(layer instanceof AVLayer)) {
alert('请选择一个素材图层');
return;
}
var mainSource = layer.source.mainSource;
if (!(mainSource.file instanceof File)) {
alert('素材图层没有文件源');
return;
}
var img = mainSource.file;
var appSpecifier = 'photoshop';
var bridgeTalk = new BridgeTalk();
bridgeTalk.target = appSpecifier;
bridgeTalk.body = 'app.open(' + img.toSource() + ')';
bridgeTalk.onError = function (e) { throw e; };
bridgeTalk.send();
BridgeTalk.isRunning(appSpecifier)
? system.callSystem(BridgeTalk.getAppPath(appSpecifier))
: BridgeTalk.bringToFront(appSpecifier);
}());
用BridgeTalk进行程序通信,当ps打开的时候,brringToFront方法不能把ps切到前台,所以用cmd切