2 Replies Latest reply on Sep 6, 2016 9:46 PM by eun young junge46173962

    difficult to equalize the position of the image

    eun young junge46173962

      Hello!!

      It will make a script difficult to ask for help.

      1. Select and copy all the images in the document AAA.ai.

      2. Paste the BBB.ai document.

      3. However, the image of AAA and BBB are located must be the same.

       

       

      It is difficult to equalize the position of the image.

      Please help me.

       

       

       

       

      var inputFolderPath = null;

      var totalFilesConverted = 0;

      var inputFolderPath = new Folder(Folder.selectDialog('AAA folder select.'));

      var inputFolderPath2 = new Folder(Folder.selectDialog('BBB folder select.'));

      var testFiles = inputFolderPath.getFiles("*.ai");

      var testFiles2 = inputFolderPath2.getFiles("*.ai");

       

       

      try{

       

      for (d = 0; d < testFiles.length;d++)

            {

       

      var docRef =  app.open(testFiles[d]);

      var doc = docRef.activeLayer;

      var docName = docRef.name;

      var newGroup = doc.groupItems.add();

       

      for (var i = doc.pageItems.length-1; i >= 0; i--) {

      var p = doc.pageItems[i];

      if(p.guides != true&&p.typename != "TextFrame")

      {

      p.selected =true;

      }   

      }

       

       

      var selectedObject = docRef.selection;

      app.copy();

       

       

      var docRef2 = app.open(new File(inputFolderPath2 + "/" + docName));

      var doc2 = docRef2.activeLayer;

       

       

      for (var i = doc2.pageItems.length-1; i >= 0; i--) {

      var p2 = doc2.pageItems[i];

      if(p2.guides != true&&p2.typename != "TextFrame")

      {

      p2.selected =true;

      }   

      }

      if ( docRef2.selection.length > 0 ) {

      for (var i = selection.length-1; i >= 0; i--) {

          selection[i].remove();

      }

      }

       

       

       

       

      app.paste();

       

       

       

      docRef2.save();

      }

       

       

      }

       

      catch(e) {

        alert(e);} 

         

       

       

      alert('OK');