13 Replies Latest reply on Jan 10, 2016 5:03 AM by dorothea.per

    problems with script at indesign

    dorothea.per

      hello everyone,

      i am new and at scripting so,,,i hope i can explain what i need

       

      well i have an indesign file in which i need to insert an extra layer with the translation of a language,,,have a EN layer for English and an extra one FR for french,

      i found a script that is like this

      with (app.clipboardPreferences){

      pasteRemembersLayers =true;

      }

       

      var docTarget = app.documents.itemByName('English.indd');

      var docSource = app.documents.itemByName('French.indd');

       

      if (docSource.isValid && docTarget.isValid){

      var numSpreads = docSource.spreads.length;

      for ( var i = 0; i < numSpreads; i++ ) {

      app.activeDocument=docSource;

      app.activeWindow.activeSpread = app.activeDocument.spreads[i];

      app.select(app.activeDocument.spreads[i].allPageItems);

      if (app.selection.length >0){

      app.copy();

      app.activeDocument=docTarget;

      if (app.activeDocument.spreads[i].isValid){

      app.activeWindow.activeSpread = app.activeDocument.spreads[i];

      app.pasteInPlace();

      }

      }

      }

      }

       

      but it seems to cause problems with files,

      i have to say that source is a very heavy file, even entering takes a lot of time,

      but i just want to enter text layer,

      do you think this script will eventually work, can you spot a mistake or something?