2 Replies Latest reply on Feb 11, 2016 11:29 PM by Vamitul

    How do I paste to the spread?

    Elmnas Level 1

      Hello people,

       

      I have got following code

      [pre]

      app.clipboardPreferences.pasteRemembersLayers = false; //or true, set this as you need it. 

       

      app.activeDocument.layers.add ({name: "TT_IDML", layerColor: UIColors.lightBlue}); 

       

      var docSource=app.activeDocument;

       

      var myFolder = Folder.selectDialog("Choose the folder")

       

      if(myFolder.length==0)

      {

          alert("No Folder Selected")

          exit(0)

          }

       

       

      var myFiles = myFolder.getFiles("*.idml")

       

      if(myFiles.length==0)

      {

          alert("No InDesign files in folder")

          }

       

       

      for(i=0; i<myFiles.length; i++)

      {

         

         

          myFile = myFiles[i]

      //    alert(myFile)   

          app.open(myFile)

       

       

       

       

      var docTarget=app.activeDocument;

       

       

       

       

      var paletteObjects = app.activeDocument.layers[0].allPageItems;

      app.select(paletteObjects); 

      app.copy(); 

       

       

      app.activeDocument=docSource;

       

       

      app.documents[0].activeLayer = app.documents[0].layers.itemByName("TT_IDML"); 

      app.select(null); // Be careful what is selected, if you are using pasteInPlace() 

      app.pasteInPlace(); 

       

       

      app.activeDocument=docTarget;

      app.activeDocument.close(SaveOptions.no) 

       

      //app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

       

          }

       

      [/pre]

       

       

      I wonder how do I paste it to the spread? (also close to the document not 5 miles away)

       

       

       

       

      Thank you in advance