1 Reply Latest reply on Sep 25, 2009 7:10 AM by Peter Kahrel

    [VB][CS] Bug - why myStory.Contents <> myStory.Texts.Item(1).Contents ?

    AdobeScripts Level 3

      hi

       

      for me it is bug - but maybe there is logical explanation ...

       

      it occurs in ID CS2 and CS4 - so probably in CS3, too

       

      let's say we have only one TextFrame in document with contents:

       

      Line1<enter>

      Line2<#>

       

      and run something like this (VBScript/VB6 example):

       

      set myindi = createobject("indesign.application.cs2")
      set mydoc = myindi.activedocument

       

      set mystory = mydoc.stories.item(1)

      ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      mystory.insertionpoints.item(1).contents = "QQQ" & vbcr
      mystory.insertionpoints.item(-1).contents = vbcr & "QQQ"
      msgbox(mystory.contents)

       

      message will be:

       

      QQQ

      Line1

      Line2

      QQQ

       

      but this code:

       

      set myindi = createobject("indesign.application.cs2")
      set mydoc = myindi.activedocument

       

      set mystory = mydoc.stories.item(1).texts.item(1)

      ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      mystory.insertionpoints.item(1).contents = "QQQ" & vbcr
      mystory.insertionpoints.item(-1).contents = vbcr & "QQQ"
      msgbox(mystory.contents)

       

      return message with this:

       

      Line1

      Line2

      QQQ

       

      so ... why adding at end works but adding at beginning not ?

       

      and the same behavior is for Word object - and probably for all other objects with .Texts

       

      robin

       

      www.adobescripts.co.uk