Làm cách nào để có tập lệnh .jsx khi hoàn thành việc thực thi tập lệnh .jsx khác?Kịch bản Adobe InDesign .jsx thực thi .jsx script
Có lẽ điều này sẽ giúp hiểu những gì tôi đang cố gắng để làm:
// 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>
Hy vọng rằng sẽ giúp?
Tôi gặp một chút khó khăn khi đọc, tôi sẽ đặt kịch bản mà tôi muốn khởi chạy ở đâu (PrintCard.jsx)? – jmituzas
var theScriptFile = new File ("/ absolute/path/to/PrintCard.jsx"); nhưng ... bạn có thể cần đường dẫn tuyệt đối ... các ứng dụng adobe có thể hoạt động khác nhau về các đường dẫn tương đối; bạn sẽ phải thử nghiệm với InDesign để xem bạn có thể làm File mới ("../ PrintCard.jsx") hay tương tự; nếu có thể, cố gắng tránh con đường tuyệt đối mà tôi nghĩ. –
Hahaha Tôi nên đọc lại nó kể từ khi bạn nói: tệp mới ("/ path/to/file.jsx"); - xin lỗi về điều đó ... – jmituzas