7 Replies Latest reply on Nov 10, 2015 2:11 AM by Vinicius Baptista

    How to place textfields on a specific place on an specified artboard - javascript ?

    peterl48251779

      found this script, but it places the textframe always on the first artboard, but want it f.e. on artboard 3

       

      // PLACING ITEMS ON ARTBOARD

       

      if ( app.documents.length > 0) {

          doc = app.activeDocument;

       

           // Get the active Artboard index

          var activeAB = doc.artboards[doc.artboards.getActiveArtboardIndex()];

        

          // Get the Height of the Artboard

          var artboardBottom = activeAB.artboardRect[3];

       

       

          // The page item you want to move. Reference it how you will. This just

          // obviously grabs the first pageItem in the document.

          var myPageItem = doc.pageItems[0];

       

       

          // Here is where the magic happens. Set the poition of the item.

          // [0,0] would be at the top left, so we have to compensate for the artboard

          // height. We add myPageItem's height for offset, or we'd end up BELOW

          // the artboard.

          myPageItem.position = [0, artboardBottom + myPageItem.height];

      }