0 Replies Latest reply on Mar 24, 2009 5:40 AM by (Robert_Tkaczyk)

    [CS4][VB] Bug or new "great" feature ? :( ... and solution

    Level 1
      hi

      could anybody please tell my WHY this code:

      set myindi=createobject("indesign.application")
      set mydoc=myindi.activedocument
      set mySel = myindi.selection.item(1)

      for a=mySel.textstyleranges.item(1).paragraphs.count to 1 step -1
      msgbox(mySel.textstyleranges.item(1).paragraphs.item(a).textstyleranges.item(1).contents)
      next

      return different results in CS2 and CS4 ?

      myText is like this:

      item1
      item2
      item3

      all three lines have same formatting - applied same ParagraphStyle - no local formatting - so there is only ONE TextStyleRange

      when I try to process each line (from back) - and I'm refering to TextStyleRange of each paragraph - in CS2 I get contents of TextStyleRange ONLY from specified paragraph

      item3
      item2
      item1

      but in CS4 - it will return contents from current paragraph to end of TextStyleRange - so after processing all paragraphs I have:

      item3
      item2(enter)item3
      item1(enter)item2(enter)item3

      so ... there is another problem - if TextStyleRange (as parent) should work like parent Paragraph of same text - then why this TextStyleRange don't return WHOLE contents of parent TextStyleRange (contents of all three paragraphs) - but return from current paragraph to the end of TextStyleRange ?



      ok ... and here is solution (dicovered when editing this post before sending) ...

      msgbox(myindi.selection.item(1).textstyleranges.item(1).paragraphs.item(a).textstyleranges .item(1).paragraphs.item(1).contents)

      after refering to TextStyleRange of Paragraph - we need to refer again to first Paragraph of this TextStyleRange ...

      thanks
      robin

      --
      www.adobescripts.com