6 Replies Latest reply on Dec 19, 2014 3:09 AM by hamdifem

    How to with script add rectangle frame tool

    hamdifem Level 1

      app.activeDocument.rectangles.add   Rectangle Tool  adding

      but I want adding Rectangle Frame Tool  (isn't rectangle tool)

       

      also where, the current, active page How can I add

        • 1. Re: How to with script add rectangle frame tool
          Chinnadk Level 4

          Try this,

           

          var doc = app.activeDocument;
          var currentPage = doc.layoutWindows[0].activePage;
          currentPage.rectangles.add({geometricBounds:[0,0,100,100]}) //It adds the rectangle on the current page
          currentPage.textFrames.add({geometricBounds:[100,0,200,100]})//It adds the textframe on the current page
          

           

          Regards,

          Chinna

          • 2. Re: How to with script add rectangle frame tool
            hamdifem Level 1

            great but facing pages while on the right page adding to the left page

            and I want to add my isn't rectangle tool I want adding Rectangle Frame Tool

             

            0001.jpg

            • 3. Re: Re: How to with script add rectangle frame tool
              Chinnadk Level 4

              Try now,

               

              var doc = app.activeDocument;
              doc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
              var currentPage = doc.layoutWindows[0].activePage;
              currentPage.rectangles.add({geometricBounds:[0,0,100,100], contentType:ContentType.GRAPHIC_TYPE}) //It adds the rectangle on the current page
              currentPage.textFrames.add({geometricBounds:[100,0,200,100]})//It adds the textframe on the current page
              
              

               

              Regards,

              Chinna

              • 4. Re: How to with script add rectangle frame tool
                hamdifem Level 1

                this my script but

                 

                var myDoc = app.activeDocument; 

                myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

                var currentPage = myDoc.layoutWindows[0].activePage;

                var myLayer = app.activeDocument.layers.add ({name: "QR"});

                myLayer.layerColor = UIColors.GRASS_GREEN;

                myLayer.move(LocationOptions.AT_BEGINNING);  // üste taşı

                var myFrame = currentPage.rectangles.add ({geometricBounds:[42.5,158.5,54.4,172.5]});

                myFrame.contentType = ContentType.GRAPHIC_TYPE;

                myFrame.appliedObjectStyle = krkod;

                myFrame.frameFittingOptions.autoFit = true;

                myFrame.itemLayer = myLayer;

                 

                When I run the second time

                There is already a layer with this name

                in this case What should I add

                • 5. Re: Re: How to with script add rectangle frame tool
                  Chinnadk Level 4

                  Try this,

                   

                  var myDoc = app.activeDocument; 
                  myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
                  var currentPage = myDoc.layoutWindows[0].activePage;
                  var myLayer = app.activeDocument.layers.item("QR");
                  if(!myLayer.isValid)
                  {
                          myLayer = app.activeDocument.layers.add ({name: "QR"});
                      }
                  myLayer.layerColor = UIColors.GRASS_GREEN;
                  myLayer.move(LocationOptions.AT_BEGINNING);  // üste taşı
                  var myFrame = currentPage.rectangles.add ({geometricBounds:[42.5,158.5,54.4,172.5]});
                  myFrame.contentType = ContentType.GRAPHIC_TYPE;
                  myFrame.appliedObjectStyle = krkod;
                  myFrame.frameFittingOptions.autoFit = true;
                  myFrame.itemLayer = myLayer;
                  

                   

                  Regards,

                  Chinna

                  • 6. Re: How to with script add rectangle frame tool
                    hamdifem Level 1

                    thank you very much

                    finally Now you explain  " !myLayer.isValid " What does that mean