.vbs script to execute .jsx script or re-write .jsx to .vbs
jmituzas Nov 10, 2010 8:09 AMOK I have 2 options here to get the job done
First and Probably the easiest a way to execute a .jsx script from a .vbs script.
What I need to do is run a .vbs script that will read info from a tab-delimited text file (depending on which tab) and write in the 3 Variables to a .jsx script used with InDesign. Afterwards have the script run the .jsx script.
Or I can re-write the .jsx script into the exsisting .vbs script (much harder)
Here is the script I will have to convert into .vbs if that is the case other wise I will have to find a way to execute this script from the .vbs script:
// this file is named WebCard.jsx
//
//An InDesign CS5 JavaScript.
//
// INSTRUCTIONS:
// make sure you save your merged doc before running script !
// Save as P:/RxCut/In Design Implementation/group#/brand~WebCard~group#.indd
// Edit lines 23 - 25 with appropriate data
// Make sure not to remove any quotes or simi-colon for end of statement.
// Enjoy
main();
function main(){
mySetup();
mySnippet();
myTeardown();
}
//<setup>
function mySetup(){
group = "RXC353";
brand = "Generic";
date = "11092010";
// DO NOT EDIT BELOW THIS LINE !!!
dirPath = "P:/RxCut/In Design Implementation/" + group + "/";
app.open(File(dirPath + brand + "~WebCard~" + group + ".indd"));
//If the master spread contains more than a single
//page, delete the additional pages.
}
{
contents:SpecialCharacters.autoPageNumber
}
//</setup>
//<snippet>
function mySnippet(){
//<fragment>
//Ordinarily, exporting a document to EPS would create a single EPS file
//for every page in the document (as EPS is a single-page format). We'll
//export each page separately, because we want to control the file name.
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;
}
//The name of the exported files will be the base name + the
//page name + ".pdf". If the page name contains a colon (as it will
//if the document contains sections), then remove the colon.
fileName = group + " " + myPageName + " " + date + ".jpg";
myFilePath = dirPath + docType + fileName;
myDocument.exportFile(ExportFormat.jpg, File(myFilePath), false);
}
//</fragment>
}
//</snippet>
//<teardown>
function myTeardown(){
}
//</teardown>
Any help will be greatly appreciated,
Thanks in advance,
Joe

