Adobe InDesign .jsx 脚本执行 .jsx 脚本

标签 adobe adobe-indesign extendscript

完成执行另一个 .jsx 脚本后,如何让我的 .jsx 脚本?

也许这将有助于理解我正在尝试做的事情:

// WebCard.jsx file

function mySnippet(){
    //<fragment>
    var myPageName, myFilePath, myFile;
    var myDocument = app.documents.item(0);
    var myBaseName = myDocument.name;
    for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
        myPageName = myDocument.pages.item(myCounter).name;
        app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
        app.jpegExportPreferences.resolution = 96;
       app.jpegExportPreferences.pageString = myPageName;  

          switch(myPageName) {
        case "1" : myPageName = "EN FRONT WebCard";
            docType = "Web/Web Cards" break;
        case "2" : myPageName = "EN BACK WebCard";
            docType = "Web/Web Cards" break;
        case "3" : myPageName = "ES FRONT WebCard";
            docType = "Web/Web Cards" break;
        case "4" : myPageName = "ES BACK WebCard";
            docType = "Web/Web Cards" break;

    }
        fileName = group + " " + myPageName + " " + date + ".jpg";

        myFilePath = dirPath + docType + "/" + fileName;
        myDocument.exportFile(ExportFormat.jpg, File(myFilePath), false);
    }
    //</fragment>
}
//</snippet>
                // execute PrintCard.jsx file


//<teardown>
function myTeardown(){
}
//</teardown>

最佳答案

您可以轻松包含另一个脚本,该脚本将在您包含它的地方执行:

// ... Do something (will be executed before teardown script)


#include "../path/to/teardown/script.jsx" 
// the path can be absolute or relative.

这应该适用于从 CS3 向上的 InDesign。

关于Adobe InDesign .jsx 脚本执行 .jsx 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4695444/

相关文章:

javascript - 如何从 url 下载图像以在 Photoshop 脚本中使用(ExtendScript 工具包)

javascript - 消失面板

mobile - Adobe Air Mobile 初创公司

adobe - 获取 ExtendScript 中错误的堆栈跟踪

python-2.7 - 使用 Python 2.7 在 Web 浏览器中流式传输视频。

javascript - 插画脚本: How to print layers name?

image-processing - Photoshop/InDesign CS5 脚本 : image size conversion error is using too much memory?

c++ - 带有 Boost.Filesystem 的 InDesign 插件没有出现在程序中

extendscript - After Effects/ExtendScript : Using libraries and importing . jsx 文件?