Copy link to clipboard
Copied
Hi everyone, help needed.
I am very new to scripting and co., I’m trying to compile a script that changes the height value for c.a. 250 .indd files,
I was able to change the document height for 1 .indd through scripting.
I acknowledge that the script is very basic, but that’s what I was able to accomplish with the knowledge and the time at my disposal.
Can someone help me understand how can I loop this script for all the files in a folder (or all the opened documents)?
Thanks in advance.
Please check @Carmelo5FA3
var myFileLocation = Folder.selectDialog("Please select path to files");
myFolder = new Folder ([myFileLocation]);
myFolderContents = myFolder.getFiles("*.indd"); // array
myFileAmount = (myFolderContents.length - 1);
for (i = myFileAmount; i >= 0; i--)
{
app.open(File (myFolderContents[i]));
var myDoc = app.activeDocument;
myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDoc.viewPreferences.verticalMeasurementUnits = M...
Copy link to clipboard
Copied
Maybe something like this?
var myDoc;
var myFolder = Folder(""); //Insert your folder path between the quotes
var myFiles = myFolder.getFiles("*.indd"); //Grabs just the .indd files
for (i=0; i<myFiles.length; i++) {
app.open(myFiles[i]);
myDoc = app.activeDocument;
myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters;
myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;
myDoc.documentPreferences.pageHeight = 78;
myDoc.close(SaveOptions.YES);
}
Copy link to clipboard
Copied
Hi danaken3,
Thanks for the answer, I’ve tried, but when I try to start the script in InDesign nothing happens.
I have tried also to change the Files path to another location (changing the relative path in the script) but it didn’t help.
Copy link to clipboard
Copied
Please check @Carmelo5FA3
var myFileLocation = Folder.selectDialog("Please select path to files");
myFolder = new Folder ([myFileLocation]);
myFolderContents = myFolder.getFiles("*.indd"); // array
myFileAmount = (myFolderContents.length - 1);
for (i = myFileAmount; i >= 0; i--)
{
app.open(File (myFolderContents[i]));
var myDoc = app.activeDocument;
myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDoc.documentPreferences.pageHeight = 78;
myDoc.close(SaveOptions.YES);
}
Copy link to clipboard
Copied
Wow, Thanks Anantha Prabu G thats works perfectly.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more