Skip navigation
999 Views 4 Replies Latest reply: Mar 19, 2012 11:09 AM by ptc-3297166 RSS
ptc-3297166 Silver 173 posts since
Jun 15, 2010
Currently Being Moderated

Mar 15, 2012 7:38 AM

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

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

 

#Enter;

  insert_tag("indexterm");

  LineUp;

  CharLeftExtend; repeat 5;

  EditCopy;

  LineDown; repeat 2;

  EditPaste;

 

Thanks Bryon

Attachments:
  • ptc-925309 Bronze 60 posts since
    Dec 26, 2011

    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:

     

    http://blog.single-sourcing.com/top-arbortext-resources

     

    Good luck!

  • ptc-780844 Gold 280 posts since
    Jul 29, 2005

    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

     

    $table_rows=tbl_row_count()

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

        oid_select(oid_caret(0))

        copy_mark mymark

        insert_tag(indexterm)

        paste mymark

    #    insert("-")

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

        {

        break

        }

    }

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 3 points
  • Helpful Answers - 1 points