Skip to main content
Robert at ID-Tasker
Legend
September 25, 2009
Question

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

  • September 25, 2009
  • 1 reply
  • 558 views

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

This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
September 25, 2009

Hello Robin,

Looks like a VB thing: JS doesn't show that behaviour (in CS4).

Peter