1 Reply Latest reply on May 2, 2008 3:17 PM by sstanleyau

    [AS CS3] Please Help. How do I combine consecutive codes.

      Hi everyone,
      I am sure this is probably child's play for the Applescript gurus here, but I am having a problem with it (obviously I am far from an applescript guru), so I am asking for HELP.
      I am trying to combine a bunch of codes that are in a text box.
      For example I have:
      AB1N, AB2N, AB3N, AB5N, AB6N, AB9N, BCD15N, BCD16N, BCD18N
      and I would like them to look like:
      AB1-3N, AB5-6N, AB9N, BCD15-16N, BCD18N
      I guess you catch my drift. I am combining the consecutive ones. Right now I have to do it manually and my list is much longer than the example obviously so I was trying to script it.
      Here is where I am at:

      tell application "Adobe InDesign CS3"
      set find grep preferences to nothing
      set change grep preferences to nothing
      set include footnotes of find change grep options to false
      set include hidden layers of find change grep options to false
      set include locked layers for find of find change grep options to false
      set include locked stories for find of find change grep options to false
      set include master pages of find change grep options to false
      set find what of find grep preferences to "[\\l\\u]+\\d+[\\l\\u]+"
      tell document 1
      set myFoundItems to find grep
      end tell
      if characters 1 thru 2 of item 1 of myFoundItems = characters 1 thru 2 of item 2 of myFoundItems then ????
      end if
      end tell

      I am trying to use find and replace but I don't think it will work. Any suggestinons are welcome.
      Thanks