2 Replies Latest reply on Sep 29, 2013 5:42 PM by klk_nc

    ExtendScript example for Frame - changing tags by table column

    klk_nc Level 1

      In the excellent book Unstructured Framemaker 11, there is Chapter 25 on using Extendscript, the only place I have seen

      a cogent, coherent walkthrough of the history behind ExtendScript for Frame (evolving form the FDK) and an example showing good

      design principles. The example shows how, starting from the small to the large tasks, select a cell, filter it for a criteria, and highlight the

      cell, make these functions, then wrap these in functions that select all the tables of a specific name, then go through a document, etc.

       

      I would like to learn more about Extendscript, I'm going through the Scripting Guide, but the key is the tweak for finding a specific column,

      changing the tag for the heading cell of the column to a specified format, then changing the remaining "normal" cells of the column to a specified format.

      That is the trick, since the heading cell needs have the option to be a different format, since the tag_name would help identify the rest of cells in the

      column.

       

      I'll come up with the main parts of the program, but it's the getting the specified column and specifying the heading cell and then the remaining

      cells is the tricky part.

        • 1. Re: ExtendScript example for Frame - changing tags by table column
          frameexpert Level 4

          Thanks for the kind words about the ExtendScript chapter in Matt Sullivan's book. OK, let's start at the beginning. Since you read the chapter, you know how important it is to start with a selection. We want to start with a single table containing the insertion point. Can you post code to will get us to the table that contains the insertion point? If so, I will provide the next step. If not, let me know, and I will get you started. Thanks.

           

          Rick

          • 2. Re: ExtendScript example for Frame - changing tags by table column
            klk_nc Level 1

            OK, starting at the lowest level is getting the column selected, since we need to select the correct column

            before selecting the first cell in the column to rename (a separate funciton?) and then the remaining cells

            in the column (another function)? Once these two functions are done, the rest would be like the example in the

            the Frame book, since then you would have a function select only the tables that have a certain name and then

            all the files in the book.

             

            #target framemaker

            // !! first, click on table

            var doc=app.ActiveDoc;

            //Get the table containing the insertion point

            var tbl=doc.SelectedTbl;

            //Get the first cell in the first row

            var cell=tbl.FirstRowInTbl.FirstCellInRow;

             

            var colNum=3;

            for (var i=1; i<colNum; i+=1){

                cell=cell.NextCellInRow;

            }

               

            while (cell.ObjectValid()){

                var pgf=cell.FirstPgf;

                alert (pgf.Name);

                alert(cell);

                cell=cell.CellBelowInCol;// Move down to next cell

            }