1 Reply Latest reply on Dec 5, 2014 12:25 PM by pixxxel schubser

    tab leaders in tables

    VeluVK Level 1

      Hi,

       

      Anyone please suggest my code errors?

       

      I need the leader dots in every first column of all the tables. tabs need to be stop before 6pts of the column width.

       

      var myDoc = app.activeDocument;   

      var myTable = myDoc.stories.everyItem().tables.everyItem().getElements();   

      for(t=0; t<myTable.length; t++)   

      {  

          var col = myTable[t].columns[0].select();

          var myFirstColumn = myTables[t].columns[0].width; 

          app.findGrepPreferences = app.changeGrepPreferences = null; 

          app.findGrepPreferences.findWhat = "(.+)$"; 

          found = app.selection[0].findGrep (true); 

      for (i = 0; i < found.length; i++) 

      {

        found[i].insertionPoints[-1].contents = "\t";

        TabStops.position = myFirstColumn - "6pt";      

      }

       

       

      The code shows the below error.

       

       

      Regards,

      Velu

        • 1. Re: tab leaders in tables
          pixxxel schubser Level 5

          Hi VeluVK,

          I'm not sure if I understand you right.

          And I'm sure there are better possibilities to do what you want.

           

          But with this little changes your code will run:

           

          var myDoc = app.activeDocument;
          var myTable = myDoc.stories.everyItem().tables.everyItem().getElements();
          for(t=0; t<myTable.length; t++)
          {
              var col = myTable[t].columns[0].select();
              //var myFirstColumn = myTables[t].columns[0].width;
              var myFirstColumn = myTable[t].columns[0].width;
          
              app.findGrepPreferences = app.changeGrepPreferences = null;
              app.findGrepPreferences.findWhat = "(.+)$";
              found = app.selection[0].findGrep (true);
          
          for (i = 0; i < found.length; i++)
          {
            //found[i].insertionPoints[-1].contents = "\t";
            //TabStops.position = myFirstColumn - "6pt";
            found[i].tabStops.add( {position:myFirstColumn - 6});
            found[i].insertionPoints[-1].contents = "\t";
          }
          }
          
          

           

          Remember – I'm not an InDesign scripter.

          Have fun