1 Reply Latest reply on Jul 27, 2010 7:46 AM by Shonkyin

    Scripting in vb.net

    karthikb1987

      I need to know how to create indesign document with layers and layers conataining textframes. How to do this with vb.net or javascript.

      Pls help!!!!!!!!!!!!!!!!!!

        • 1. Re: Scripting in vb.net
          Shonkyin Level 3

          You can see below code for javascript example.

           

          //MakeTextFrameAndLayer.jsx
          //An InDesign CS4 JavaScript
          //
          //Creates a text frame in an example document.
          main();
          function main(){
              mySetup();
              mySnippet();
              myTeardown();
          }
          function mySetup(){
              var myDocument = app.documents.add();
              //Set the measurement units to points.
              myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
              myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
          }
          function mySnippet(){
              //<fragment>
              var myDocument = app.documents.item(0);
              var myPage = myDocument.pages.item(0);
               //Add a layer.
               try{
                    var myLayer = myDocument.layers.item("myLayer");
                    myLayer.name;
               }
               catch (myEror){
                    var myLayer = myDocument.layers.add({name:"myLayer"});
               }
               var myTextFrame = myPage.textFrames.add();
              //Set the bounds of the text frame.
              myTextFrame.geometricBounds = [72, 72, 288, 288];
              //Enter text in the text frame.
              myTextFrame.contents = "This is some example text."
              //Note that you could also use a properties record to
              //create the frame and set its bounds and contents in one line:
              //var myTextFrame = myDocument.pages.item(0).textFrames.add({geometricBounds:[72, 72, 288, 288], contents:"This is some example text."});
              //</fragment>
          }
          function myTeardown(){
          }
          

           

           

          Shonky