首页 > 解决方案 > Photoshop 脚本 - 如果/当拖放运行时工作正常,添加到脚本时返回错误。现在甚至无法在全新安装时运行

问题描述

我经常需要将许多带有细微过渡或重复图案的图像拼接在一起,但是将它们全部加载到 Photomerge 并一次性运行很容易出现一系列问题(对齐不良、图像完全遗漏等)所以我发现最好的解决方法是将其分解并一次在两个图像上运行合并>保存它们>接下来的两个>保存它们>等等,直到所有图像都已配对..然后再次开始该过程这些组合集创建更大的组合集..一次又一次,直到只剩下一个文件。当文件是 80MP 和 16 位 tiff 时,非常耗时,但我确实找到了一个批量拼接解决方案,它可以组合目标文件夹的每个相应子文件夹中的任何内容。

然后我雇了一个人根据这个创建一个脚本,这基本上可以为我消除:一个文件夹中的 12 个文件将被配对和缝合(AB CD EF GH IJ KL),然后它会再次运行它(ABCD EFGH IJKL ) 并再次 (ABCDEFGH IJKL) 直到只剩下一个文件 (ABCDEFGHIJKL)。他们为它提供了 photomerge.jsx,我被指示将其拖放到 PS 中,选择目标文件夹,然后让它完成它的工作。它工作得很好。

但后来我试图将脚本移动到 PS 中的脚本菜单中。没用。将 PS 中的 photomerge.jsx 替换为提供的那个 - 这也不起作用。恢复原始 photomerge.jsx 并尝试按照最初的指示通过拖放运行脚本:不走运。卸载 PS,重新安装,尝试原始功能脚本 - 并返回相同的错误。

Error 2: folder is undefined. 
-> errorLog = errorLog.concat(decodeURI(folder));

从我看到脚本工作的方式来看,在子文件夹中创建了两个文件夹(测试文件夹 1、测试文件夹 2),并在那里进行合并。该脚本似乎在结束之前完成了第一次合并。

相应的部分在这里:

///merges all files in [fList] and saves the result in [saveLoc]
///the result is every 2 couple images are merged together in [saveLoc]
function photomergeAllFilesAsCouples(fList,saveLoc)
{
    //divide the list into equal sized couple lists
    var subLists = divideIntoSubCouples(fList)
    for(var si = 0; si < subLists.length;si++)
    {
        var subList = subLists[si];
        try 
        {
            // The Photomerge generates an unsaved new document with layers
            if(TEST_MODE)
                open(subList[0])
            else
                photomerge.createPanorama(subList, false);
                
            try{
                if(!TEST_MODE) activeDocument.mergeVisibleLayers();
            } catch(e) {}
        
            var resultFileName = RemoveExtension(subList[0].displayName) + RemoveExtension(subList[1].displayName);
            if(TEST_MODE)
                SaveJPG(saveLoc,resultFileName,1);
            else
                SaveTIFF(saveLoc,resultFileName);

            // close the document without saving 
            activeDocument.close(SaveOptions.DONOTSAVECHANGES);

            // if we've reached this point without hitting an error then the child folder is considered properly stitched
            numberOfGood = numberOfGood+1;
        } catch (e) {
            errorLog = errorLog.concat("\nUndetermined error on ");
            errorLog = errorLog.concat(decodeURI(folder));
            errorLog = errorLog.concat(" ");
        } // end catch
    } 
}

任何人都可以建议这是哪里出了这么可怕的错误吗?

标签: photoshopphotoshop-script

解决方案


推荐阅读