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

resize page size

Explorer ,
Jan 14, 2020 Jan 14, 2020

Hi all,

I have 185 idml files in different folders, all page size must be 6 mm smaller

this is what i have and works. Now I search for the code to open all files and restore them in the right place

 

main(); function main(){ //Make certain that user interaction (display of dialogs, etc.) is turned on. app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll; var myPageHeight = app.activeDocument.documentPreferences.pageHeight; var myPageWidth = app.activeDocument.documentPreferences.pageWidth; app.activeDocument.documentPreferences.pageWidth = myPageWidth -6; app.activeDocument.documentPreferences.pageHeight = myPageHeight -6; }

 

TOPICS
Bug , How to , Import and export , Scripting
690
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

Explorer , Jan 14, 2020 Jan 14, 2020

thanks all

the code works well now just a little problem with the bleed 

 

#target indesign
var catalog = Folder.selectDialog ("/Users/lucclottemans/Desktop/BRIEFPAPIER_A4_R/");
if ( !catalog ) { exit(); }

var idml = [];
collectFiles ( catalog );
//$.writeln("FILE "+collectFiles);

alert ( idml.join( '\n' ) ) ;

 for (var x= 0; x < idml.length; x++){
    // app.activeDocument.save(File(fileName), true);
    $.writeln("FILE"+ idml[x]);
app.open(idml[x]);

    var myPageHeight = app.activeDocument.d
...
Translate
Community Expert ,
Jan 14, 2020 Jan 14, 2020

Have a look at the Adjust Layout facility to see if that can help resize your documents.

 

Screenshot 2020-01-14 at 14.26.15.pngexpand image

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 14, 2020 Jan 14, 2020

the resize code works well, I have to open all pages and resave as idml

 

var myFolder = new Folder("/Users/lucclottemans/Desktop/AFFICHE_A1_R/");
function scanSubFolders(tFolder, mask) { // folder object, RegExp or string
    var sFolders = new Array();
    var allFiles = new Array();
    sFolders[0] = tFolder;
    for (var j = 0; j < sFolders.length; j++){ // loop through folders           
        var procFiles = sFolders[j].getFiles();
        for (var i=0;i<procFiles.length;i++){ // loop through this folder contents
            if (procFiles[j] instanceof File ){
                if(mask==undefined) allFiles.push(procFiles[j]);// if no search mask collect all files
     //           if (procFiles[j].fullName.search(mask) != -1) allFiles.push(procFiles[j]); // otherwise only those that match mask
allFiles.push(procFiles[j]);
        }else if (procFiles[j] instanceof Folder){
            sFolders.push(procFiles[j]);// store the subfolder
            scanSubFolders(procFiles[j], mask);// search the subfolder
         }
     else {
}
      }
   }
   return [allFiles,sFolders];
};
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 14, 2020 Jan 14, 2020

Hi, 

try this snippet of code to collect all indd files down the folders tree. Then you got an array full of innd files to further process 🙂

regards

 

#target indesign

var catalog = Folder.selectDialog ('Select a folder.');
if ( !catalog ) { exit(); }

var indd = [];

collectFiles ( catalog );

alert ( indd.join( '\n' ) ) ;

function collectFiles ( folder ) {
var files = folder.getFiles();
for ( var i =0; i < files.length; i++ ) {
if ( files[i].constructor.name == 'File' && files[i].name.slice(-4) == 'indd' ) {
indd.push( files[i] );
}
if ( files[i].constructor.name == 'Folder' ) {
collectFiles ( files[i] );
}
}
}

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
Community Expert ,
Jan 14, 2020 Jan 14, 2020

Hi,

you could use your script with Peter Kahrel's Batch/Convert script that is also able to read IDML files.

 

Batch-process (convert/export/import) documents

by Peter Kahrel

https://creativepro.com/files/kahrel/indesign/batch_convert.html

 

Regards,
Uwe Laubender

( ACP )

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 14, 2020 Jan 14, 2020
LATEST

thanks all

the code works well now just a little problem with the bleed 

 

#target indesign
var catalog = Folder.selectDialog ("/Users/lucclottemans/Desktop/BRIEFPAPIER_A4_R/");
if ( !catalog ) { exit(); }

var idml = [];
collectFiles ( catalog );
//$.writeln("FILE "+collectFiles);

alert ( idml.join( '\n' ) ) ;

 for (var x= 0; x < idml.length; x++){
    // app.activeDocument.save(File(fileName), true);
    $.writeln("FILE"+ idml[x]);
app.open(idml[x]);

    var myPageHeight = app.activeDocument.documentPreferences.pageHeight;
	var myPageWidth = app.activeDocument.documentPreferences.pageWidth;
    
app.activeDocument.documentPreferences.pageWidth = myPageWidth -6;
app.activeDocument.documentPreferences.pageHeight = myPageHeight -6;

      documentPreferences.properties = {
      documentBleedBottomOffset : 3,
      documentBleedTopOffset : 3,
      documentBleedInsideOrLeftOffset : 3,
      documentBleedOutsideOrRightOffset : 3
     }
      app.activeDocument.save(idml[x]);
     app.activeDocument.close(); 
 }

function collectFiles ( folder ) {
  
    var files = folder.getFiles();
    for ( var i =0; i < files.length; i++ ) {
        if ( files[i].constructor.name == 'File' && files[i].name.slice(-4) == 'idml' ) {
            idml.push( files[i] );
        }
        if ( files[i].constructor.name == 'Folder' ) {
            collectFiles ( files[i] );
        }
            //$.writeln("FILE "+collectFiles);
    }
    return idml;
}
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