Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
10

Indesign script change height in multiple Indesign Files

Explorer ,
Jan 31, 2024 Jan 31, 2024

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.

 

{var doc = app.activeDocument;
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;  
var newHeight = 78
doc.documentPreferences.pageHeight  = newHeight}

 

 

TOPICS
Scripting
633
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Feb 01, 2024 Feb 01, 2024

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
...
Translate
Participant ,
Jan 31, 2024 Jan 31, 2024

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);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2024 Jan 31, 2024

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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 01, 2024 Feb 01, 2024

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);

}

 

 

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2024 Feb 01, 2024
LATEST

Wow, Thanks Anantha Prabu G thats works perfectly.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines