4 Replies Latest reply: Mar 19, 2012 11:09 AM by bfriesen RSS

    arbortext 6 Macro help to automate creating an index entry into a table

    bfriesen Silver

      Hi I need some help creatinga macro that will copy the contents of a cell and create an index tag with those contents. I have created one but it only works with 6 digit numbers and only can do one cell at a time. We have a mix of 4, 5 and 6 digit part numbers. What I would like to do is select the entire column, maybe 20 or entries and run this macro and have an index tag created for each one. I cannot seem to change the amount of characters that I can select or number of cells as I seems to mess everything up if I do it that way


      Here is what I got





      CharLeftExtend; repeat 5;


      LineDown; repeat 2;



      Thanks Bryon

        • Re: arbortext 6 Macro help to automate creating an index entry into a table
          pnagai Silver

          Hi Bryon,

          I think you are going to find more reliable results using the oid_xxxx commands within ACL (Arbortext Command Language). Search help for oid_select for starters. It will require learning to think about your document as a node tree, not strings of characters (except at the far, leafy tips of that tree).


          I would use the following approach the problem you've presented.


          Get the OID (this is the name of the XML node, or Object IDentifier, every oid is unique within a document) for the table. Get the oid for the tgroup (I am assuming CALS table model). Get the oid for the tbody. Get the list of oids for the rows. Copy the contents of the first entry. (How you execute the previous step may be different depending on how the number is inserted in <entry>.) Move the cursor into the first entry. Insert <indexterm>. Insert the copied contents. Repeat for the rest of the rows. (Don't forget to handle exceptions like no data in entry, merged cells, etc.)


          Here is an example of one of those steps:


          audiences = oid_find_children($theater_oid, audience_arr, "audience");


          This takes a known oid ($theater_oid) and collects all of the oids of its <audience> children and stores those oids in an array, audience_arr[]. $audiences is filled with the number or count of <audience> children found. Now I can process each of those audience elements like this:


          for (i = 1 ; i <= $audiences ; i++) {

          name = get_name(audience_arr[$i];

          response($name . ' is sitting in seat number ' . $i . '.')

          } # for


          Hope that helps.


          You should consider joining the Adepters mailing list where lots and lots of Arbortext users, admins, and developers hang out 24/7/366 (it is a leap year, you know!). Information on joining that list (as well as pointers to lots of other Arbortext resources) can be found here:




          Good luck!

          • Re: arbortext 6 Macro help to automate creating an index entry into a table
            dtsarev Gold

            Hi Bryon



            See below a simple ACL script which seem to do what you need.

            Also see the video demoeing it: http://communities.ptc.com/videos/2679



            while(tbl_caret_row() <= $table_rows && tbl_caret_row() > 0) {


            copy_mark mymark


            paste mymark

            # insert("-")

            if (goto_cell(tbl_caret_row()+1, 1) != 1)