0 Replies Latest reply on Dec 23, 2012 10:29 AM by BEGINNER_X

    Copy Graphics from DOC1 and Paste in Doc2

    BEGINNER_X Level 3

      Hi ALL / EXPERTS,

       

       

      PLEASE HELP OUT FOR FIRST TASK IN MY JAVASCRIPT CAREER....

       

       

      I am the beginner only.

       

      I am trying  for last few days in forum, image catlog and scripting tutorials etc....

       

       

      Requirement:

       

      1. My requirement is copy all the graphics in my Source Document (doc1) and paste in Target Document (doc2) .

       

      2. Place all images in doc2 but try to avoid white spaces as much as possible

       

      3. All images with 100%

       

      For example "doc1" having 100 pages include 50 images in various pages. The script want to collect all images and paste in "doc2". It paste as much as possible like horizontally or vertically with  "0p6"space between two figures. 100% for all images.

       

       

      Trying Script:

       

      Still now what i am trying is, copy all the images from Source Document (Doc1) and paste in Target Document (Doc2) in the particular place. My script put all the images over to one another.

       

       

      var myDocument = app.documents.item(0)

       

      var myDocument1 = app.documents.item(1)

       

      var myGraphics = myDocument.allGraphics

       

       

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

      {

          if(i==0)

          {

              app.activeWindow = app.windows.item(0)

              app.select(myGraphics[i].parent)

              app.copy()

              app.activeWindow = app.windows.item(1)

              //app.pasteInPlace()

              app.paste()

       

              }

        

      if(i!=0)

      {

          app.activeWindow = app.windows.item(1)

          app.select(myGraphics[i].parent)

          app.copy()

          app.activeWindow = app.windows.item(1)

          //app.pasteInPlace()

          app.paste()

       

          }

      }

       

       

      Please can anyone give solution for my above script.

       

       

      Thanks in advance

      BEGINNER