Photoshop JS错误:发生一般Photoshop错误。此版本的Photoshop

时间:2018-02-14 09:28:12

标签: javascript photoshop extendscript

我收到了#34;一般的Photoshop错误。此版本的Photoshop可能无法使用此功能。"运行以下代码时出错:

var watermarklineGroup  = app.activeDocument.layerSets.getByName('WATERMARK.LINE');
var snGroup             = app.activeDocument.layerSets.getByName('SERIAL NUMBERS');

var wmLayerOne          = watermarklineGroup.layers[0];
var wmLayerTwo          = watermarklineGroup.layers[1];
var wmLayerThree        = watermarklineGroup.layers[2];
var wmLayerFour         = watermarklineGroup.layers[3];
var wmLayerFive         = watermarklineGroup.layers[4];
var wmLayerSix          = watermarklineGroup.layers[5];
var wmLayerSeven        = watermarklineGroup.layers[6];
var wmLayerEight        = watermarklineGroup.layers[7];

var snLayerOne          = snGroup.layers[0];
var snLayerTwo          = snGroup.layers[1];
var snLayerThree        = snGroup.layers[2];
var snLayerFour         = snGroup.layers[3];
var snLayerFive         = snGroup.layers[4];
var snLayerSix          = snGroup.layers[5];
var snLayerSeven        = snGroup.layers[6];
var snLayerEight        = snGroup.layers[7];

var intFirstSetOfFive   = CreateRandom5 ();
var intSecondSetOfFive  = CreateRandom5 ();
var intThirdSetOfFive   = CreateRandom5 ();


(function main(){        
    WriteGeneratedNumbers();
})();


function CreateRandom5(){
    min = Math.ceil(10000);
    max = Math.floor(99999);
    return Math.floor(Math.random() * (max - min));
}

function WriteGeneratedNumbers(){
    for (var i = 0; i>8; i++){        

        snGroup.layers[i].textItem.contents             = intFirstSetOfFive + " " + intSecondSetOfFive + " " + intThirdSetOfFive;

        watermarklineGroup.layers[i].textItem.contents  = intFirstSetOfFive + intSecondSetOfFive + intThirdSetOfFive;

        alert(snGroup.layers[i].textItem.contents);
        alert(watermarklineGroup.layers[i].textItem.contents);

        intThirdSetOfFive = CreateRandom5 ();
        i++;
     }
}

目前变量是多余的,但我只是想刷新我的JS(已经10年了)。我的文字图层没有任何样式。

ScreenShot of Layers Panel

0 个答案:

没有答案