JSX / Photoshop:选择初始历史快照 - 寻找更短的方式

时间:2014-10-12 09:29:25

标签: history snapshot photoshop-script jsx

我有一段代码可以选择活动文档的初始状态(快照)。

我想知道是否存在实现同一目标的简短方法。

这是实际的脚本:

var myDoc = app.activeDocument.name;
var doc = app.activeDocument.historyStates.length;

alert("History States : " + doc);


function firstStep(enabled, withDialog) {
  if (enabled != undefined && !enabled)
    return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putName(cTID('SnpS'), myDoc);
    desc1.putReference(cTID('null'), ref1);
    executeAction(cTID('slct'), desc1, dialogMode); 
    alert("Selected Initial State");                
};

firstStep();

提前致谢

1 个答案:

答案 0 :(得分:1)

这些方面的内容对您有用:

docRef.activeHistoryState = docRef.historyStates.getByName('Snapshot 0');