0 Replies Latest reply on Nov 28, 2012 8:57 AM by _S_KEMP_

    CS4 JSX Replace characters with library items

    _S_KEMP_ Level 1

      Hi,

       

      I want to replace individual characters in labelled text frames with a specific item from a single library.

       

      The items are icons that represent features for a product. The idea is that the author of the product spec can key in "abc" in the supplied copy, and after placing into InDesign, a script will replace character "a" with an icon from the library (named "a"), character "b" replaced with item "b" etc.

       

      There are several instances of these character strings on a page.

       

      I can script most of this but I am stuck with the best strategy to get the individual characters and iterate through them in the most efficient way.

       

      The character strings are all in their own text frame which could be labelled (several frames with the same label).

       

      Can I get all the frames using TextFrames.itemByName("labelname") and use characters.contents or would I be better using a Find based on paragraph style and iterating through "myFinds"?

       

      Or is there a more obvious approach I havent considered.

       

      Thanks

       

      Simon