3 Replies Latest reply on Oct 26, 2012 3:55 AM by hurix@123

    How to place text in Indesign library using JS

    gopaljay78

      Hi,

       

      Can anybody help me on the following  scripts.

       

      I have a Indesign library which contain 1 asset. This asset is groups of graphic frames and text frames. The text frames are linked together.

      What I want is, pull the element from the library and place some text in the textframe and place that element in the indesign  pages.

       

      I am able to  pull the element from the library. But unable to place the text into the textframes.

       

      Can anybody help me on this.

       

      My coding is below.

      -------------------------

       

      var graphicLibrary = new File("/Users/premedia/Desktop/Indesign_AutoPg/Library.indl");
      if (graphicLibrary.exists) {
          app.open(File("/Users/premedia/Desktop/Indesign_AutoPg/Library.indl"));   
          }
      else {   
          alert("Creating new Library");
          var graphicLibrary = app.libraries.add(File("/Users/premedia/Desktop/Indesign_AutoPg/Library.indl"));
          }

       

      var getGraphics = getGraphicsFunc(graphicLibrary);

      function getGraphicsFunc(graphicLibrary)
      {
          var t = app.libraries.item(0);
          libList = t.assets.everyItem().name;
          for (var i=0; i<libList.length; i++)
          {
              myAsset = t.assets.item(i);
              var libItem = myAsset.placeAsset(app.documents[0]);
              // Here I want to place some text in the textframes of library element.
              }
          }

       

       

      Thanks in advance.

       

      Regares,

      Gopal