I'm a fairly new programmer. I'm attempting something pretty advanced, but I enjoy a good challenge. :~) I'm using Adobe's ESTK (ExtendScript Toolkit) to write a complex script for InDesign CS6. I've gone through most of the tutorials and have learned quite a bit, but I have run into a wall now.
I need the script to detect whether a certain folder meets a certain criteria, and if it does, to delve into that folder, count all of its subfolders, and open each of the .indd files in each of those subfolders, in turn, performing tasks on each one. I have only just started the script today and this is what I've got so far:
var getDataDialog = app.dialogs.add({name:"Job Info"});
with(getDataDialog){
// Add a dialog column.
with(dialogColumns.add()){
// Create the order number text edit box.
var orderNumTextEditBox = textEditboxes.add({minWidth:80});
}
}
// Show the dialog box.
var dialogResult = getDataDialog.show();
if(dialogResult == true){
// Get the order number and put it in the variable "orderNum".
var orderNum = orderNumTextEditBox.editContents;
// Get the first three numbers of the order number and put it in "orderPrefix".
var orderPrefix = orderNum.substr(0,3);
// Remove the dialog box from memory.
getDataDialog.destroy();
// Store the folder prefix into "folderPrefix".
var folderPrefix = "/g/ ArtDept/JOBS/" + orderPrefix + "000-" + orderPrefix + "999/"
// Open the document with the order number.
var myDoc = app.open(File(folderPrefix + orderNum + " Folder/" + orderNum + ".indd"), true);
}
else{
getDataDialog.destroy();
}
So, if the order number entered is "405042", it will look in the "405000-405999" folder, then into the packaged folder called "405042 Folder", then open the .indd file inside that. Trouble is, we sometimes have several packages within a folder. For example, we might have:
405000-405999/405007/405007_N10/405007_N10.indd
405000-405999/405007/405007_C12/405007_C12.indd
405000-405999/405007/405007_Orange/405007_Orange.indd
I would want the script to open up each of those files, in turn, and perform some tasks on them. I'm certain that it's possible, but I just need to know how to code it.