0 Replies Latest reply on Dec 12, 2014 2:40 AM by kenarli91

    illustrator into indesign graphic transfer

    kenarli91

      Hello, I wrote that I received from illustrator graphics program with the code I want to settle into the framework of the code indesign program. I also want to establish the number of cycles can not perform the settlement into the frame from left to right. and illustrator program in two or more variables that each one provides the number of settlements Can I want to cycle one by one to take


       

      var myDocument = app.activeDocument;

       

       

      myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;

       

       

      myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

       

       

      var sekil = new Array;

       

       

      sekil = ["Kare", "Oval"]

       

       

      var myDialog = app.dialogs.add({name:"Sablon Olusturma", canCancel:true});

       

       

      with (myDialog){

       

       

          with (dialogColumns.add()){

       

       

              with (borderPanels.add()){

       

       

                  with(dialogColumns.add()){

       

       

                      staticTexts.add({staticLabel:"Kalip Eni :", minWidth:90});

       

       

                      staticTexts.add({staticLabel:"Kalip Boyu :", minWidth:90});

       

       

                  }

       

       

                  with (dialogColumns.add()){

       

       

                      var kalipEn = textEditboxes.add();

       

       

                      var kalipBoy = textEditboxes.add();

       

       

                  }

       

       

              }

       

       

              with(borderPanels.add()){

       

       

                  with (dialogColumns.add()){

       

       

                      staticTexts.add({staticLabel:"Ara Bosluk :", minWidth:90});

       

       

                  }

       

       

                  with (dialogColumns.add()){

       

       

                      var gutter = textEditboxes.add();

       

       

                  }

       

       

              }

       

       

              with(borderPanels.add()){

       

       

                  with (dialogColumns.add()){

       

       

                      staticTexts.add({staticLabel:"Tekli Eni :", minWidth:90});

       

       

                      staticTexts.add({staticLabel:"Tekli Boyu :", minWidth:90});

       

       

                  }

       

       

                  with (dialogColumns.add()){

       

       

                      var tekliEn = textEditboxes.add();

       

       

                      var tekliBoy = textEditboxes.add();

       

       

                  }

       

       

              }

       

       

              with (borderPanels.add()){

       

       

                  with (dialogColumns.add()){

       

       

                      staticTexts.add({staticLabel:"Cizim Sekli :", minWidth:90});

       

       

                      staticTexts.add({staticLabel:"Radius :", minWidth:90});

       

       

                  }

       

       

                  with(dialogColumns.add()){

       

       

                      var myDrop = dropdowns.add({stringList:sekil, selectedIndex:0});

       

       

                      var tRadius = textEditboxes.add();

       

       

                  }

       

       

              }

       

       

          }

       

       

      }

       

       

      var diaSonuc = myDialog.show();

       

       

      if (diaSonuc == true){

       

       

          var kEn = parseInt(kalipEn.editContents);

       

       

          var kBoy = parseInt(kalipBoy.editContents);

       

       

          var kgutter = gutter.editContents;

       

       

          if ((kgutter == null) || (kgutter == "")){

       

       

              kgutter = 0;

       

       

          } else {

       

       

              kgutter = parseInt(kgutter);

       

       

          }

       

       

          var tEn = parseInt(tekliEn.editContents);

       

       

          var tBoy = parseInt(tekliBoy.editContents);

       

       

          var myRadius = tRadius.editContents;

       

       

          if ((myRadius == null) || (myRadius == "")){

       

       

              myRadius = 0;

       

       

          } else {

       

       

              myRadius = parseInt(myRadius);

       

       

          }

       

       

          var yatay = Math.floor(kEn / (tEn+kgutter));

       

       

          var dikey = Math.floor(kBoy / (tBoy+kgutter));

       

       

          var genislik = (tEn * yatay) + (kgutter * (yatay - 1));

       

       

          var boy = (tBoy * dikey) + (kgutter * (dikey - 1));

       

       

          var startMarginLeft = (kEn - genislik) / 2;

       

       

          var startMarginTop = kBoy - (boy+10);

       

       

          if (startMarginLeft < 7){

       

       

              yatay = yatay -1;

       

       

              genislik = (tEn * yatay) + (kgutter * (yatay - 1));

       

       

              startMarginLeft = (kEn - genislik) / 2;

       

       

          }

       

       

          if (startMarginTop<10){

       

       

              dikey= dikey-1;

       

       

              boy = (tBoy * dikey) + (kgutter * (dikey - 1));

       

       

              startMarginTop = kBoy - (boy+10);

       

       

          }

       

       

          var sonuc = "Yatay :" + yatay + "  " + "Dikey :" + dikey + "\n Kaliptaki Etiket Sayisi :" + (yatay*dikey);

       

       

          alert(sonuc);

       

       

       

       

       

          var myLayer = myDocument.layers.item("Sablon");

       

       

          try{

       

       

              myLayerName = myLayer.name;

       

       

          }

       

       

          catch (myError){

       

       

              var myLayer = myDocument.layers.add({name:"Sablon"});

       

       

          }

       

       

          var myCutterColor = myDocument.colors.item("Bicak");

       

       

          try{

       

       

              myCutterColorName = myCutterColor.name;

       

       

          }

       

       

          catch(myError){

       

       

              var myCutterColor = myDocument.colors.add({name:"Bicak", model:ColorModel.process, colorValue:[0, 100, 100, 0]});

       

       

          }

       

       

          var myNoneSwatch = myDocument.swatches.item("None");

       

       

          var myRegistration = myDocument.colors.item("Registration");

       

       

          var myEtiket = new Array;

       

       

          var myCross1 = new Array;

       

       

          var myCross2 = new Array;

       

       

          var myCross3 = new Array;

       

       

          var myCross4 = new Array;

       

       

          var myCross5 = new Array;

       

       

          var myCross6 = new Array;

       

       

          var myCross7 = new Array;

       

       

          var myCross8 = new Array;

       

       

          if (myDrop.selectedIndex == 0){

       

       

              myEtiket[0] = myDocument.rectangles.add(myLayer, undefined, undefined, {strokeColor:myCutterColor, strokeWeight:0.25, fillColor:myNoneSwatch, geometricBounds:[startMarginTop, startMarginLeft, (tBoy+startMarginTop), (tEn+startMarginLeft)]});

       

       

              if (myRadius != 0){

       

       

                  myEtiket[0].cornerOption = CornerOptions.ROUNDED_CORNER;

       

       

                  myEtiket[0].cornerRadius =myRadius;         

       

       

              }

       

       

          }

       

       

          if (myDrop.selectedIndex == 1){

       

       

              myEtiket[0] = myDocument.ovals.add(myLayer, undefined, undefined, {strokeColor:myCutterColor, strokeWeight:0.25, fillColor:myNoneSwatch, geometricBounds:[startMarginTop, startMarginLeft, (tBoy+startMarginTop), (tEn+startMarginLeft)]});

       

       

          }

       

       

          myCross1[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[startMarginTop, (startMarginLeft-3), startMarginTop, (startMarginLeft-10)]});

       

       

          myCross2[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop+tBoy), (startMarginLeft-3), (startMarginTop+tBoy), (startMarginLeft-10)]});

       

       

          myCross3[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[startMarginTop, (startMarginLeft+genislik+3), startMarginTop, (startMarginLeft+genislik+10)]});

       

       

          myCross4[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop+tBoy), (startMarginLeft+genislik+3), (startMarginTop+tBoy), (startMarginLeft+genislik+10)]});

       

       

          myCross5[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop-3), startMarginLeft, (startMarginTop-10), startMarginLeft]});

       

       

          myCross6[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop-3), (startMarginLeft+tEn), (startMarginTop-10), (startMarginLeft+tEn)]});

       

       

          myCross7[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop+boy+3), startMarginLeft, (startMarginTop+boy+10), startMarginLeft]});

       

       

          myCross8[0] = myDocument.graphicLines.add(myLayer,undefined, undefined,{strokeColor:myRegistration, strokeWeight:0.25, fillcolor:myNoneSwatch, geometricBounds:[(startMarginTop+boy+3), (startMarginLeft+tEn), (startMarginTop+boy+10), (startMarginLeft+tEn)]});

       

       

          var mmToPoint = 2.83464567

       

       

              for (var verti = 1; verti <= (dikey-1); verti++){

       

       

              var myVertDist = ((tBoy+kgutter)*verti)*mmToPoint;

       

       

              var myTransformationMatrix = app.transformationMatrices.add({verticalTranslation:myVertDist});

       

       

              myEtiket[verti] = myEtiket[0].duplicate();

       

       

              myCross1[verti] = myCross1[0].duplicate();

       

       

              myCross2[verti] = myCross2[0].duplicate();

       

       

              myCross3[verti] = myCross3[0].duplicate();

       

       

              myCross4[verti] = myCross4[0].duplicate();

       

       

              myEtiket[verti].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix);

       

       

              myCross1[verti].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix);

       

       

              myCross2[verti].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix);

       

       

              myCross3[verti].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix);

       

       

              myCross4[verti].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix);

       

       

          }

       

       

          for(var diz = 0; diz <= (dikey-1); diz++){

       

       

              for (var myCounter = 1; myCounter <= (yatay-1); myCounter++){

       

       

                  var myDistance = ((tEn + kgutter)*myCounter)*mmToPoint;

       

       

                  var myTransformationMatrix1 = app.transformationMatrices.add({horizontalTranslation:myDistance});

       

       

                  myEtiket[dikey+myCounter] = myEtiket[diz].duplicate();

       

       

                  myEtiket[dikey+myCounter].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix1);

       

       

              }         

       

       

          }

       

       

          for (var yanDiz = 1; yanDiz <= (yatay-1); yanDiz++){

       

       

              var myDistance = ((tEn + kgutter)*yanDiz)*mmToPoint;

       

       

              var myTransformationMatrix2 = app.transformationMatrices.add({horizontalTranslation:myDistance});

       

       

              myCross5[yatay+yanDiz] = myCross5[0].duplicate();

       

       

              myCross6[yatay+yanDiz] = myCross6[0].duplicate();

       

       

              myCross7[yatay+yanDiz] = myCross7[0].duplicate();

       

       

              myCross8[yatay+yanDiz] = myCross8[0].duplicate();         

       

       

              myCross5[yatay+yanDiz].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix2);

       

       

              myCross6[yatay+yanDiz].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix2);

       

       

              myCross7[yatay+yanDiz].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix2);

       

       

              myCross8[yatay+yanDiz].transform(CoordinateSpaces.pasteboardCoordinates, [[0,0], BoundingBoxLimits.geometricPathBounds], myTransformationMatrix2);

       

       

          }

       

       

          myDialog.destroy();

       

       

      }

      var myGraphicFile = File.openDialog("Choose a graphic file");

       

       

      if((myGraphicFile != "")&&(myGraphicFile != null)){

       

       

      var myGraphic = myDocument.pages.item(0).place(myGraphicFile);

       

       

       

      myGraphic = myGraphic[0];