Photoshop的Javascript,它告诉我它期望的奇怪错误;,

Photoshop的Javascript,它告诉我它期望的奇怪错误;,,javascript,frameworks,adobe,photoshop,Javascript,Frameworks,Adobe,Photoshop,它告诉我它期待什么;在60号线上。我从一位开发人员那里得到了这段代码,他让这一切都正常工作,但现在它在我的计算机上不工作了 这是一个为photoshop js编写的脚本,用于根据层是否存在的条件执行某些操作 你们认为会是什么 实际上,我必须写更多关于这方面的东西,因为stackoverflow告诉我“你的文章大部分是代码,但我不知道该写什么。我可以补充一点,必须执行操作的层的名称存储在一个名为workingLayer的变量中,该值从桌面上的文件TITLE.txt中读取 function some

它告诉我它期待什么;在60号线上。我从一位开发人员那里得到了这段代码,他让这一切都正常工作,但现在它在我的计算机上不工作了

这是一个为photoshop js编写的脚本,用于根据层是否存在的条件执行某些操作

你们认为会是什么

实际上,我必须写更多关于这方面的东西,因为stackoverflow告诉我“你的文章大部分是代码,但我不知道该写什么。我可以补充一点,必须执行操作的层的名称存储在一个名为workingLayer的变量中,该值从桌面上的文件TITLE.txt中读取

function somename(){
    #target photoshop
    
    var fileRef = "C:/Users/Dharmindar/OneDrive/Desktop/NAME.txt"
    var doc = open(fileRef);
    alert(doc);
}
// this function somename is supposably testing if the name.txt can be opened and it gives an alert 

// this is anther test function I guess to see how to get layers name or document name I am not sure what he did here

function testFunction() {
    var testName = app.activeDocument.name;
    var nameWithoutExt = testName.split(".")[0];
    nameWithoutExt = nameWithoutExt + ", " + app.activeDocument.layers[0].name;
    alert(nameWithoutExt);
}






   //here he lists files from folder desktop and then he loops and searches for a file named TITLE.txt. from there he reads the value that he puts into a layer workingLayer. Later he will execute function based on the fact if the layer exists or not.
function SomeOtherFunction() {
    //Choose the desired folder
    var currentFolder = new Folder('~/desktop/');

    //Get files from the selected folder
    var currentFiles = currentFolder.getFiles(); 
    var selectedFile;

    for (i = 0; i < currentFiles.length; i++) {
        if  (currentFiles[i] == "~/desktop/NAME.txt") {
          selectedFile = currentFiles[i];
        }
    }


 // here he reads the file he opens and equates it to working layer
        selectedFile.open("r");
        var workingLayer = selectedFile.read();
    
        alert(workingLayer);

    var layers = app.activeDocument.layers;
    //alert(layers);

    for (l = 0; l < layers.length; l++) {
        //alert(layers[l].name + " - " + str); 
        var currentLayer = layers[l].name;
         // here he conditions and says if the working layer is equal to the current layer name then execute action exists from custom made 1145Actionset and later he says else, if it does not exist the layer with equal name as working layer then execute action 

        if(currentLayer.name == workingLayer) {
            currentLayer.name = "0";
            ExecuteAction("EXISTS","1145ActionSet");
        } else {
            ExecuteAction("NOTEXISTS","1145ActionSet");
        }

        RenameLayer("0", workingLayer, layers);
    }
}


//here he created function rename layer which is supposed to change layer names after the action has been completed and why was this needed? well it was needed because photoshop actions can not work with variables so what he did he changes the layer name to "0" and then executes action always on layer "0" and then after that he changes the layer 0 back to workingLayer variable value that comes from that TITLE.txt and that is pretty much all there is to it and this weird thing gives me error exactly on the line 60 it says it expects ; 
functon RenameLayer(oldName, newName, layers) {
    for (var j=0;j < layers.length; j++) {
        if (layers[j].name == oldName ){
            layers[j].name = newName;
        }
    }
}


function ExecuteAction(actionName, actionSetName) {
    try {
        //TO DO IF THE LAYER DOESNOT EXISTS
        //Action set must be created first and the action should be in that.
        //The first parameter is the name of th action to be performed and the second parameter is the name of th ActionSet
        app.doAction(actionName,actionSetName);
    } catch(e) {
        alert(e);
    }
}


SomeOtherFunction();
函数somename(){
#目标photoshop
var fileRef=“C:/Users/Dharmindar/OneDrive/Desktop/NAME.txt”
var doc=打开(fileRef);
警报(doc);
}
//此函数somename可用于测试name.txt是否可以打开并发出警报
//这是另一个测试函数,我想看看如何获得层名或文档名,我不知道他在这里做了什么
函数testFunction(){
var testName=app.activeDocument.name;
var nameWithoutExt=testName.split(“.”[0];
nameWithoutExt=nameWithoutExt+,“+app.activeDocument.layers[0]。名称;
警报(nameWithoutExt);
}
//在这里,他列出了文件夹桌面上的文件,然后循环搜索名为TITLE.txt的文件。从那里,他读取输入到图层workingLayer中的值。稍后,他将根据图层是否存在的事实执行函数。
函数SomeOtherFunction(){
//选择所需的文件夹
var currentFolder=新文件夹(“~/desktop/”);
//从所选文件夹获取文件
var currentFiles=currentFolder.getFiles();
变量选择文件;
对于(i=0;i
此代码中的第60行是什么?这是一个爱好者网站,他们在空闲时间免费提供帮助。他们至少可以期待一些请求,如果你发布了这么多的代码,至少在错误发生的地方添加一些注释,以及错误消息的确切内容…@derpirscher会这样做,所以代码将“function”拼错为“functon”。啊哈!!是的,我修复了它,但由于某种原因,它现在执行两次操作。我执行的操作是“NOTEXISTS”