🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
1 messages
1 total messages Started by Robert Tkaczyk Tue, 24 Mar 2009 13:40
[CS4][VB] Bug or new "great" feature ? :( ... and solution
#431
Author: Robert Tkaczyk
Date: Tue, 24 Mar 2009 13:40
49 lines
2378 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads